# ElasticsearchException: failed to create index [my_index] - limit of total shards [1000] for cluster [my_cluster] exceeded

- **ID:** `elasticsearch/shards-limit-exceeded`
- **Domain:** elasticsearch
- **Category:** resource_error
- **Verification:** ai_generated
- **Fix Rate:** 82%

## Root Cause

The cluster has reached its maximum allowed number of shards (default 1000 per node or cluster-level limit), preventing index creation or opening.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 7.10.0 | active | — | — |
| 7.17.0 | active | — | — |
| 8.0.0 | active | — | — |
| 8.5.0 | active | — | — |

## Workarounds

1. **Increase the cluster-level shard limit dynamically: PUT _cluster/settings { "persistent": { "cluster.max_shards_per_node": 2000 } }** (85% success)
   ```
   Increase the cluster-level shard limit dynamically: PUT _cluster/settings { "persistent": { "cluster.max_shards_per_node": 2000 } }
   ```
2. **Reduce shard count by merging small indices or deleting unused indices: POST _cat/indices?v | awk '{print $3}' | xargs -I {} curl -XDELETE 'http://localhost:9200/{}'** (80% success)
   ```
   Reduce shard count by merging small indices or deleting unused indices: POST _cat/indices?v | awk '{print $3}' | xargs -I {} curl -XDELETE 'http://localhost:9200/{}'
   ```
3. **Set a per-index shard limit to prevent future overflow: PUT _cluster/settings { "persistent": { "cluster.max_shards_per_node.frozen": 500 } }** (75% success)
   ```
   Set a per-index shard limit to prevent future overflow: PUT _cluster/settings { "persistent": { "cluster.max_shards_per_node.frozen": 500 } }
   ```

## Dead Ends

- **** — Shard counts are persisted in cluster state and metadata, not reset on restart; this only causes temporary downtime without fixing the limit. (95% fail)
- **** — The limit applies to the entire cluster, not just one index. Deleting a single index does not free enough shards if the cluster is at capacity. (70% fail)
- **** — Adding replicas increases total shard count, making the problem worse. The limit caps total shards including replicas. (90% fail)
