Skip to content

Troubleshooting guide

Elasticsearch cluster status red: how to fix it

Red means at least one primary shard is unassigned, so some data is not searchable. The allocation explain API tells you why.

3 min read10 sectionsUpdated

On this page

Key points

  • Red: a primary is missing. Yellow: only replicas are.
  • _cluster/allocation/explain gives the reason.
  • Disk watermarks stop allocation well before the disk fills.
  • Allocating an empty primary loses data, so treat it as a last resort.

What red means

Each index has primary shards and replicas. If a primary and all its replicas are unavailable, Elasticsearch cannot serve or write that part of the index. Other indices continue to work, so red does not imply that everything is down.

Common causes

  • Node loss with no replica available.
  • Disk watermarks: at 85 percent no new shards are allocated, at 90 percent shards move away, at 95 percent indices go read-only.
  • Too many shards for the cluster's heap.
  • Corrupted shard data.
  • Allocation filters that exclude every node.

Diagnose it

Find the affected indices, and ask for the reason.

bash
# Health, and which indices are red
curl -s localhost:9200/_cluster/health?pretty
curl -s 'localhost:9200/_cat/indices?v&health=red'

# Unassigned shards and reasons
curl -s 'localhost:9200/_cat/shards?v&h=index,shard,prirep,state,unassigned.reason' | grep UNASSIGNED

# The full explanation
curl -s localhost:9200/_cluster/allocation/explain?pretty

# Disk per node
curl -s 'localhost:9200/_cat/allocation?v'

Fixes

Bring lost nodes back first, because data on them may return intact. Free disk space by removing old indices, then clear a read-only block:

PUT */_settings {"index.blocks.read_only_allow_delete": null}

Retry allocations that hit their retry limit with POST _cluster/reroute?retry_failed=true. Restore from a snapshot when data is really gone. allocate_empty_primary makes the index usable but discards the shard's data, so it should be your last choice.

Prevent the next one

Always keep at least one replica for indices you care about, and spread replicas across zones through allocation awareness. Avoid too many small shards, as each one uses heap: a rule of thumb is shards sized between 10 and 50 GB. Use index lifecycle management to roll over and delete old data automatically, so disk growth does not rely on someone remembering. Finally, take snapshots to object storage and practise restoring them, because a backup you have never restored is only a hope.

Catch it automatically

Alert on red immediately and on yellow when it lasts. Track disk per node, heap and JVM GC with Elasticsearch monitoring. A disk alert at 75 percent gives you time before the watermarks start moving shards.

Frequently asked questions

Is yellow a problem?

It means replicas are unassigned. Data is available, but with no redundancy. A single-node cluster is always yellow when replicas are configured.

Why did my index become read-only?

A node passed the flood-stage disk watermark.

Can I recover a red index without backups?

Only if a copy of the shard exists on some node.

Watch your own site and services with VitalRix

Uptime checks, APM, logs, real-user monitoring, alerts and status pages in one place. Every product has a free tier and no credit card is needed.