This alert is triggered when the health status of an Elasticsearch node index turns red
. If you receive this alert, it means that at least one primary shard and its replicas are not allocated to any node, and the data in the index is potentially at risk.
In Elasticsearch, the index health status can be green, yellow, or red:
Use the Elasticsearch _cluster/health
endpoint to check the health status of your cluster:
curl -X GET "localhost:9200/_cluster/health?pretty"
Identify the unassigned shards
Use the Elasticsearch _cat/shards
endpoint to view the status of all shards in your cluster:
curl -X GET "localhost:9200/_cat/shards?h=index,shard,prirep,state,unassigned.reason&pretty"
Check Elasticsearch logs
Examine the Elasticsearch logs for any error messages or alerts related to shard allocation. The log file is usually located at /var/log/elasticsearch/
.
Resolve shard allocation issues
Depending on the cause of the unassigned shards, you may need to perform actions such as:
_cluster/reroute
API.elasticsearch.yml
configuration file.Recheck the cluster health
After addressing the issues found in the previous steps, use the _cluster/health
endpoint again to check if the health status of the affected index has improved.