You're Seeing Yellow — Let's Fix It
You check your Elasticsearch cluster health and it says "yellow." Don't panic. It's not critical like red, but it's not green either. It means some shards aren't fully replicated. Here's the fastest way to turn it green.
The Direct Fix: Re-enable Shard Allocation
Most of the time, the cause is simple. Someone (or some script) disabled shard allocation. Or your cluster ran out of disk space temporarily. Here's the command to check and fix:
GET _cluster/settings?include_defaults=true
Look for cluster.routing.allocation.enable. If it's set to none or primaries, that's the problem. Set it back:
PUT _cluster/settings
{
"transient": {
"cluster.routing.allocation.enable": "all"
}
}
After you run that, wait 30 seconds. Then check cluster health again:
GET _cluster/health?pretty
You should see "status" : "green". If not, keep reading.
Why This Usually Works
Yellow status means all primary shards are assigned, but some replica shards aren't. Elasticsearch can't assign replicas when allocation is disabled. The setting above forces it to start moving shards again.
Another common reason: your nodes have different disk watermark settings. Elasticsearch won't allocate shards to nodes that exceed the low watermark (85% disk usage by default). Run this to see node disk usage:
GET _cat/allocation?v&h=node,shards,disk.percent
If you see a node at 90% or more, that's your bottleneck. Free up space or increase the watermark. But first, check if allocation was disabled — that's the quickest fix.
Less Common Variations of the Same Issue
1. Disk Watermark Settings
Sometimes the yellow status sticks because disk thresholds are too strict. If you're sure your nodes have space, you can relax the watermarks temporarily:
PUT _cluster/settings
{
"transient": {
"cluster.routing.allocation.disk.watermark.low": "95%",
"cluster.routing.allocation.disk.watermark.high": "98%"
}
}
But don't leave these high forever. It can cause problems when disks actually fill up.
2. Replica Count Mismatch
If you have only one node, you can't have replicas. Elasticsearch will stay yellow because the replica shards have nowhere to go. Fix: set replicas to 0 for indices that don't need them, or add more nodes.
PUT myindex/_settings
{
"number_of_replicas": 0
}
After that, recheck health. If you have only one node, this is the permanent fix.
3. Shard Allocation in Progress
Sometimes the cluster is just busy. After a node restart or a hardware failure, the cluster needs time to rebalance. Check pending tasks:
GET _cluster/pending_tasks?pretty
If you see tasks like "shard allocation" with a delay, wait 5 minutes. If they don't clear, something is stuck.
4. Flood Stage Triggers
Elasticsearch 7.16+ added a flood stage watermark. If a node crosses 95% disk usage, Elasticsearch sets all indices on that node to read-only. That can cause yellow status for some indices. Check:
GET _all/_settings?filter_path=*.settings.index.blocks
If you see "read_only_allow_delete": "true", free disk space on that node and then remove the block:
PUT _all/_settings
{
"index.blocks.read_only_allow_delete": null
}
How to Prevent Yellow Status in the Future
Three things matter most:
- Monitor disk usage. Set alerts at 75% and 85%. Don't wait until it's too late.
- Don't disable allocation manually unless you know the impact. If you do, set a recovery plan.
- Use at least 2 nodes for production. A single-node cluster can never be green with replicas.
Also, add this setting to your elasticsearch.yml to avoid accidental allocation disable:
cluster.routing.allocation.enable: all
But more importantly, put your cluster behind a monitoring tool like Elastic's built-in health API or something external. Check it weekly. Yellow status is almost always a disk or setting problem. Now you know how to fix both.