Fixing Yellow Shards in Elasticsearch
Introduction
If you’re running Elasticsearch on a single node — like a Raspberry Pi or small lab setup like I am —
you might notice some indices appear with a yellow health status.
This show article explains what that means and how to fix it, especially in resource-constrained, single-node environments.
What Does “Yellow” Mean?
In Elasticsearch:
green: All primary and replica shards are assigned and active.yellow: All primary shards are active, but at least one replica shard is unassigned.red: At least one primary shard is missing → critical!
Why Yellow Happens on Single Nodes
In single-node clusters, Elasticsearch cannot assign replica shards (because replicas must be on a different node). So any index with replicas will always be yellow unless:
- You add more nodes (not ideal on a Raspberry Pi)
- Or: You disable replicas (
number_of_replicas: 0)
Step-by-Step: Diagnose Yellow Shards
1. List all yellow indices
2. See why a shard is unassigned
3. Inspect shard assignment of a specific index
Example output:
→ The r (replica) is unassigned → yellow status.
How to Fix It
A. Fix an individual index
Set replicas to zero:
This changes the index health from yellow to green.
B. Automatically fix all yellow indices
If you want to automate the fix, use this (Kibana Dev Tools):
Then for each index in the result:
C. Prevent future yellow indices
Disable replicas by default using an index template:
> ⚠️ This applies to all future indices. Only do this in single-node environments.
Conclusion
Yellow indices aren’t dangerous by default — they just mean you’re missing redundancy. In small environments, it’s perfectly safe to run with zero replicas.
Just don’t forget to:
- Monitor your shard health
- Disable replicas if you only have one node
- Automate where you can