About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.
A cluster health status of red or yellow means one or more shards are not assigned to a node. Red means at least one primary shard is unassigned, so some searches and indexing can fail. Yellow means every primary is assigned and some replicas are not, which raises the risk of data loss. List the shards in the UNASSIGNED state, ask the cluster allocation explain API why each one is not placed, and change only the thing its decider names.
What the status means
Elasticsearch 8.15's cluster health API describes the three statuses this way: green means all shards are assigned. Yellow means all primary shards are assigned but one or more replica shards are unassigned, and "If a node in the cluster fails, some data could be unavailable until that node is repaired." Red means one or more primary shards are unassigned, so some data is unavailable, and the page adds that this can occur briefly during cluster startup as primary shards are assigned.
An index's status is its worst shard, and the cluster's is its worst index. So a single unassigned replica of one small index turns the whole cluster yellow.
Elastic's troubleshooting page says a red or yellow cluster keeps processing searches and indexing where possible, but may delay management and cleanup work, and that some index lifecycle management actions need the index to be green. In many cases the cluster recovers by itself. When it does not, the remaining causes have to be found one at a time, and the allocation explain API is the tool for that.
Likely causes
| Cause | What you see | How to confirm |
|---|---|---|
| Allocation was switched off for maintenance and not switched back on | Shards stay UNASSIGNED after nodes return |
cluster.routing.allocation.enable in the cluster settings is not the default all |
| A data node left and its replicas are waiting | Yellow right after a restart; allocation_delayed |
Explain output shows a configured and remaining delay; the default is one minute |
| Allocation filter or awareness settings exclude every node | A primary on a new index stays unassigned | The filter decider names the setting |
| No other data node can hold a replica | Yellow on a small cluster | The same_shard decider says a copy is already on the node |
| Low disk watermark reached | Shards refused on full nodes | _cat/allocation shows disk use above 85%, the default of cluster.routing.allocation.disk.watermark.low |
| Too many failed attempts | Explain says the retry limit was exceeded | The max_retry decider; default limit 5 |
| Every copy of the shard is gone | Red; no_valid_shard_copy |
Explain output; check that all nodes are in the cluster |
| Heap pressure trips circuit breakers | Allocation stops while JVM memory is high | Elastic's page says high JVM memory pressure can trigger circuit breakers that stop allocation; check heap use per node |
Prove the cause before changing anything
Everything in this section only reads. The commands use curl against localhost:9200. That is our own form of the requests that Elastic's pages show in Console syntax, with the same method, path and parameters. Add the address and credentials your cluster needs. With security enabled, the explain API needs the monitor or manage cluster privilege.
1. Read the status and the counts.
curl -s 'localhost:9200/_cluster/health?filter_path=status,*_shards'
Elastic's page says a healthy cluster "has a green status and zero unassigned_shards". It adds that a yellow status means only replicas are unassigned and a red status means one or more primary shards are unassigned.
2. List the unassigned shards.
curl -s 'localhost:9200/_cat/shards?v=true&h=index,shard,prirep,state,node,unassigned.reason&s=state'
Elastic's page says "Unassigned shards have a state of UNASSIGNED" and that prirep is p for a primary and r for a replica. Note the index, shard number and prirep of one row.
3. Ask why. The index, shard and primary values below are placeholders; use the row from step 2.
curl -s -X POST 'localhost:9200/_cluster/allocation/explain' -H 'Content-Type: application/json' -d '{"index":"orders-2026.12","shard":0,"primary":false}'
Elastic's page says the API explains, for an unassigned shard, why it is unassigned. Read these fields in the response: unassigned_info.reason, can_allocate, and in node_allocation_decisions each node's deciders list with its decision and explanation. Optional query parameters are include_disk_info and include_yes_decisions, both false by default.
4. Read the settings that govern allocation.
curl -s 'localhost:9200/_cluster/settings?flat_settings=true&include_defaults=true'
curl -s 'localhost:9200/orders-2026.12/_settings?flat_settings=true&include_defaults=true'
5. Read disk use per node.
curl -s 'localhost:9200/_cat/allocation?v=true&h=node,shards,disk.*'
Fix
Choose by what step 3 said. Several of Elastic's remedies change data or capacity. Where they do, the paragraphs below say what Elastic's page says and do not tell you to run them.
Allocation was left disabled
Elastic says you typically disable allocation during a restart or other maintenance, and that if you forgot to re-enable it afterwards, Elasticsearch cannot assign shards. The remedy is to reset the cluster.routing.allocation.enable cluster setting. Its documented values are all (the default), primaries, new_primaries and none.
First save the current state:
curl -s 'localhost:9200/_cluster/settings?flat_settings=true' > settings-before.json
Risk: the next request resets the cluster setting that controls shard allocation. Elasticsearch then starts assigning shards and recovering copies across the nodes. Our own reading: recovering copies adds disk and network load while it happens.
Reset it to the default. Elastic's settings page says it no longer recommends transient cluster settings and to use persistent ones, so persistent is the key used here. If settings-before.json shows the setting under transient instead, send the same body under transient, because the page says a transient setting takes precedence over a persistent one.
curl -s -X PUT 'localhost:9200/_cluster/settings' -H 'Content-Type: application/json' -d '{"persistent":{"cluster.routing.allocation.enable":null}}'
Risk, only if you back out: the request below sets cluster.routing.allocation.enable back to none, so Elasticsearch stops assigning shards until the setting is reset again.
To undo it: put back the value that settings-before.json recorded (here none, as an example), under the same persistent or transient key.
curl -s -X PUT 'localhost:9200/_cluster/settings' -H 'Content-Type: application/json' -d '{"persistent":{"cluster.routing.allocation.enable":"none"}}'
To check the undo, read the settings and compare with settings-before.json.
curl -s 'localhost:9200/_cluster/settings?flat_settings=true'
The retry limit was exceeded
Elasticsearch tries to allocate a shard index.allocation.max_retries times in a row (the page gives the default as 5) and then leaves it unassigned. The explain output then carries a max_retry decider saying "shard has exceeded the maximum number of retries [5] on failed allocation attempts - manually call [/_cluster/reroute?retry_failed=true] to retry". Elastic's page says to correct the problem first (it names an analyzer that refers to a stopwords file missing on some nodes as a structural example) and then retry, which it describes as a single retry round.
First save the current state:
curl -s 'localhost:9200/_cluster/health?filter_path=status,*_shards' > health-before.json
curl -s 'localhost:9200/_cat/shards?v=true&h=index,shard,prirep,state,node,unassigned.reason&s=state' > shards-before.txt
Risk: the next request makes the cluster retry every shard blocked by too many failed attempts, and so may start shard recoveries (our own reading). Elastic's page gives no way to undo it.
Run one retry round:
curl -s -X POST 'localhost:9200/_cluster/reroute?retry_failed=true'
To back out: there is no undo for the retry itself. Compare the same two read commands with health-before.json and shards-before.txt to see what changed.
A replica has no node, or the disk is full
Elastic's page says a replica is never placed on the same node as its primary, so with no other data node it stays unassigned. The options it lists are to add a data node to the same tier or to lower index.number_of_replicas, and it recommends keeping at least one replica per primary. For disks, Elasticsearch by default will not allocate shards to a node using more than 85% of its disk; the page lists upgrading disks, deleting unneeded indices or raising the low watermark as remedies. Our own advice: treat deleting indices and lowering replicas as capacity decisions taken with a snapshot in hand, not as quick fixes for a colour.
Every copy of a primary is gone
If explain says no_valid_shard_copy, Elastic says to make sure all nodes are in the cluster, because the shard is allocated when a node holding a good copy rejoins. If no such node can return, the page lists these options: restore from a snapshot, re-index from the original source, accept data loss by deleting the index, or run the reroute command allocate_stale_primary or allocate_empty_primary with accept_data_loss: true. It adds "Only use this option if node recovery is no longer possible", and says an empty primary will overwrite the data of a node that later rejoins. Elastic's page shows the command; it can destroy data, so it is not repeated. For restores, see Elasticsearch and OpenSearch snapshots: repositories, what is included, and the version rules for restore.
Example (illustrative): on es01, the only data node of a test cluster, the health call returns status yellow and unassigned_shards 1. The shard list shows index orders-2026.12, shard 0, prirep r, state UNASSIGNED. Explain for that shard returns can_allocate no and, for es01, the same_shard decider with the explanation "a copy of this shard is already allocated to this node". The primary is fine. The cause is capacity: one node cannot hold both copies. The administrator changes nothing, plans a second data node, and records the yellow status as expected until it joins.
Confirm the fix
- Repeat step 1. The status is green and
unassigned_shardsis 0, or, for a recovering cluster, the number falls. - Repeat step 2. No row shows
UNASSIGNED; shards may showINITIALIZINGwhile copies are built. - Elastic's health API can wait for a status:
wait_for_status=greenwith atimeout, for examplecurl -s 'localhost:9200/_cluster/health?wait_for_status=green&timeout=50s'. It returns when the cluster reaches that status or the time passes.
What to watch afterwards
- After any maintenance that disabled allocation, read
cluster.routing.allocation.enablebefore you close the change. - When a node restarts, expect a yellow cluster for about the delay set by
index.unassigned.node_left.delayed_timeout, which defaults to 1m, before replicas are reallocated elsewhere. - Keep disk use on data nodes below the low watermark.
- Keep snapshots current. A red index with no valid copy is recovered from one.
Read next
Related articles you may want next.
- TroubleshootingElasticsearch "blocked by: [TOO_MANY_REQUESTS/12/disk usage exceeded flood-stage watermark, index has read-only-allow-delete block": free disk space until the block releases itselfElasticsearch flood-stage watermark exceeded, index has read-only-allow-delete block: find the full node, free disk space, and let the block lift itself.Read article
- TroubleshootingElasticsearch circuit_breaking_exception "[parent] Data too large, data for [<http_request>] would be [...]": find what is using the heapElasticsearch circuit_breaking_exception [parent] Data too large: check heap.percent and breaker stats, find what uses the heap, then cut memory pressure.Read article
- Backup & RecoveryElasticsearch and OpenSearch snapshots: repositories, what is included, and the version rules for restoreHow Elasticsearch and OpenSearch snapshots work: repositories, contents, version compatibility, restore conflicts, security data and what to back up separately.Read article
Risks and limits
- These commands have not been run or lab-tested.
- The
allocate_stale_primaryandallocate_empty_primarycommands can destroy data, and Elastic's page gives no way to undo them. - Output shapes and setting names are from the 8.15 pages; other releases may differ. On a later 8.x minor or on 9.x, check the current Elastic page for the same setting or API before you run anything.
- Our own advice: deleting an index to clear a red status is a data loss decision, not a repair.
Sources
- Red or yellow cluster health status — Elastic, Elasticsearch Guide 8.15, no date shown, accessed 3 December 2026
- Cluster allocation explain API — Elastic, Elasticsearch Guide 8.15, no date shown, accessed 3 December 2026
- Cluster health API — Elastic, Elasticsearch Guide 8.15, no date shown, accessed 3 December 2026
- Cluster reroute API — Elastic, Elasticsearch Guide 8.15, no date shown, accessed 3 December 2026
- Cluster-level shard allocation and routing settings — Elastic, Elasticsearch Guide 8.15, no date shown, accessed 3 December 2026
- Cluster get settings API — Elastic, Elasticsearch Guide 8.15, no date shown, accessed 3 December 2026
- Cluster update settings API — Elastic, Elasticsearch Guide 8.15, no date shown, accessed 3 December 2026
- Delaying allocation when a node leaves — Elastic, Elasticsearch Guide 8.15, no date shown, accessed 3 December 2026
This article was originally published on .