Hello, When your OpenSearch cluster shows a yellow status, it means all primary shards are allocated but one or more replicas are not. This typically happens when the cluster does not have enough nodes to host the replicas, or when allocation rules prevent them from being assigned. The first thing to check is whether you have sufficient data nodes available. If you only have one node, replicas cannot be assigned, and the cluster will remain yellow by design. If you have multiple nodes, verify that they are healthy and part of the cluster by running GET _cat/nodes?v and GET _cluster/health.
To force allocation of unassigned shards, you can use the reroute API. For example, run POST _cluster/reroute with a command block specifying the shard, index, and target node. A typical request looks like:
POST _cluster/reroute
{
"commands": [
{
"allocate_replica": {
"index": "your_index",
"shard": 0,
"node": "node-name"
}
}
]
}
This forces OpenSearch to assign the replica shard to the specified node. Before doing this, confirm that the node has enough disk space and that allocation filtering is not blocking it. You can check allocation explanations with GET _cluster/allocation/explain which will tell you why a shard is unassigned. If the issue is related to disk watermark thresholds, adjust the settings with PUT _cluster/settings and modify cluster.routing.allocation.disk.watermark.low or high accordingly. If it is related to node filters, review cluster.routing.allocation.exclude or include settings.
In short, the safe path is to first run GET _cluster/allocation/explain to understand why replicas are not being placed, then either add more nodes, adjust allocation rules, or use the reroute API to force placement. Forcing allocation without resolving the underlying constraint may lead to instability, so always validate the health of the nodes and the capacity before applying the reroute.
I hope you've found something useful here. If it helps you get more insight into the issue, it's appreciated to accept the answer. Should you have more questions, feel free to leave a message. Have a nice day!
DV.