> For the complete documentation index, see [llms.txt](https://docs.elastiflow.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.elastiflow.com/additional-resources-reference-articles/faq/elasticsearch-opensearch-cluster-in-yellow-state.md).

# Elasticsearch / OpenSearch cluster in yellow state

## Background

A yellow health status indicates that at least one replica shard cannot be allocated in the cluster.  All primary shards will be allocated, so all data is available in this state, but data availability is at risk if a node goes down.

The health status of the cluster can be checked with the following API call:

```
GET /_cluster/health
```

## Troubleshooting and resolving a yellow health status

If the status is yellow, you can use the following API call to get information on why a shard is unallocated:

```
GET /_cluster/allocation/explain
```

The allocation explain API without a body will return information on the first unallocated shard it finds.  If you need to find details for a specific shard, you will need to include the shard information in the request body.  For further details, please see the API documentation.

* Elasticsearch:  <https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-cluster-allocation-explain>
* OpenSearch:  <https://docs.opensearch.org/latest/api-reference/cluster-api/cluster-allocation/>

There are many possible causes for shards being unallocated, so you will need to take action tailored to the reason listed in the allocation explain API output.

## Single node clusters

Replica shards cannot allocate to the same node that the primary shard resides on, so a single node setup with replicas enabled will always be in a yellow state.

For a single node cluster, replicas must be set to 0 on all indices to achieve a green status.  First, the replicas should be set to 0 in the flow collector configuration with the following settings:

* Elasticsearch:  EF\_OUTPUT\_ELASTICSEARCH\_INDEX\_TEMPLATE\_REPLICAS
* OpenSearch:  EF\_OUTPUT\_OPENSEARCH\_INDEX\_TEMPLATE\_REPLICAS

This will cause any new indices to be created with 0 replicas.  Then, the replicas for existing indices will need to be updated to 0.  For example, to change the replicas for all flow indices using codex:

```
PUT /elastiflow-flow-codex-2.5-rollover-*
{
  "settings": {
    "number_of_replicas": 0
  }
}
```

The `elastiflow-flow-codex-2.5-rollover-*` index name can be updated as needed.  Wildcards are allowed.
