如何在 AWS elasticsearch 中通过模板显式设置分片大小?

How could I put shard size explicitly by template in AWS elasticsearch?

我是 elasticsearch 的新手。我只有一个没有副本的分片,这个分片有默认的分片大小。现在我想通过使用模板显式添加分片大小。但是当我搜索这个 here 时,它没有任何 属性 来设置分片大小。我错过了什么吗?还有其他方法吗?分片的默认大小是多少?下面是我当前的模板,

{
    "index_patterns": ["centralized-logging-index-*"],
    "settings": {
        "number_of_shards": 1,
        "number_of_replicas": 0
    },
    "mappings": {
    }
}

我在 AWS 上使用 elasticsearch。

Default no of primary shards changed from 5 to 1 per index from ES 7.o version 及以上 API 应该在您想要更改索引或索引模板中的分片数量时起作用。

我刚刚通过索引 API 创建了一个包含 5 个主分片的索引。

放aws-domain/myindex

{
    "settings": {
        "number_of_shards": 5 // myindex will have 5 primary shards
     }
}

您可以使用上面的 GET 进行验证 API

获取aws-domain/myindex

{
    "myindex": {
        "aliases": {},
        "mappings": {},
        "settings": {
            "index": {
                "creation_date": "1591277226075",
                "number_of_shards": "5",
                "number_of_replicas": "1",
                "uuid": "aKbGoSs9RhC_q5iUH6qauw",
                "version": {
                    "created": "7040299"
                },
                "provided_name": "myindex"
            }
        }
    }
}

不确定,你所说的分片大小是什么意思,如果你指的是 GB 或其他大小,那么就没有 属性 可以设置它,因为它是动态的,并且会根据文档的数量而改变。