我正在使用休眠Elasticsearch集成(5.10.3)将索引从应用程序移至ES群集。我想将主分片的数量从5个减少到1个,但是在文档中找不到如何执行此操作的参考。
有人知道我如何更改分片数量吗?
在Elastic Search中,创建索引后,您将无法更改包含许多分片和副本的映射类型和设置。但是您可以使用所需数量的分片和副本将现有索引重新索引为新创建的索引。您可以像这样创建一个新的索引。例如,如果需要,我已添加了映射入口
PUT testing
{
"settings": {
"number_of_replicas": 1,
"number_of_shards": 1
},
"mappings": {
"mappingExample": {
"properties": {
"id": {
"type": "keyword"
}
}
}
}
}
然后您对]进行重新索引>
POST _reindex { "source": { "index": "yourindex" }, "dest": { "index": "testing" } }
希望这对您有帮助