ES分片数不够,导致创建索引失败

309 阅读1分钟

报错:

ValidationException[Validation Failed: 1: this action would add [5] total shards, but this cluster currently has [7999]/[8000] maximum shards open;]

原因:

集群最大shard(分片)数不足引起的,从Elasticsearch v7.0 开始,集群中的每个节点默认限制1000个分片。

解决:

方案1. 在elasticsearch.yml中定义  cluster.max_shards_per_node: 10000

方案2. PUT _cluster/settings
{
  "persistent": {
    "cluster": {
      "max_shards_per_node": 10000
    }
  }
}