
# CSS创建索引报错"maximum shards open"
#### 问题描述
创建索引时，报错显示"this action would add \[2\] total shards, but this cluster currently has \[1000\]/\[1000\] maximum shards open"。
#### 问题原因
由于节点shard数量超过最大值限制，Elasticsearch默认每个节点的shard数量是1000，如果shard数量超过这个值创建索引会报错。
#### 解决方案
- 方案一：关闭或者删除不用的索引，减少shard数量。
- 方案二：修改节点的shard数量的限制，参数配置请参考[max_shards_per_node](https://www.elastic.co/guide/en/elasticsearch/reference/current/misc-cluster-settings.html#cluster-max-shards-per-node)。
  ```
  PUT _cluster/settings
  {
    "persistent": {
      "cluster": {
        "max_shards_per_node": 2000
      }
    }
  }
  ```
  
![](https://support.huaweicloud.com/trouble-css/public_sys-resources/note_3.0-zh-cn.png)
修改节点的shard数量的限制属于临时规避方案，如果要长期解决，建议每GB的JVM堆内存小于等于20个shards（节点堆内存大小为节点内存规格的1/2，最大值为31GB），shard的建议数量详细请参见[shard count recommendation](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/size-your-shards.html#shard-count-recommendation)。
