Elasticsearch 集群的分片总数达到了上限(1000 个),无法再创建新索引

疑难杂症  

报错信息

status=400: validation_exception  
this action would add [2] total shards, but this cluster currently has [1000]/[1000] maximum shards open  

解决方案

# 1. 查看当前索引和分片占用情况
curl -s 'http://ES_HOST:9200/_cat/indices?v&s=index'  
curl -s 'http://ES_HOST:9200/_cat/shards' | wc -l

# 2. 定期删除过期的旧索引(比如 30 天前的),释放分片
curl -X DELETE 'http://ES_HOST:9200/xmname-adminapi-2026.10.*'

# 3. 或临时调高上限(治标不治本,分片过多会拖垮集群内存)
curl -X PUT 'http://ES_HOST:9200/_cluster/settings' -H 'Content-Type: application/json' -d '  
{
  "persistent": { "cluster.max_shards_per_node": 2000 }
}'