如何禁用一个索引的节点之间的分片重定位?

How disable shard relocation between nodes for one index?

我需要 elasticsearch 创建索引分片一次,并且在收到手动命令之前不要从节点重新定位现有分片。是否可以在不禁用整个集群的分片分配的情况下做到这一点?

是的,它叫做index.routing.allocation.enable,可以是运行 for a single index and it's dynamically updateable:

PUT /my_index/_settings
{
    "index" : {
        "routing.allocation.enable" : "none"
    }
}