Elasticsearch Elasticsearch Indices Without Replicas

By Opster Expert Team

Updated: Mar 10, 2024

| 1 min read

What does this mean?

Elasticsearch indices may not have replica shards. Replica shards are crucial for providing resilience and load balancing in an Elasticsearch cluster.

Why does this occur?

This issue can occur due to various reasons, such as:

  1. The cluster was initially set up with a single node, and no replicas were created.
  2. The number of replicas was explicitly set to zero during index creation.
  3. The cluster experienced a failure, and the replicas were not automatically recreated.

Possible impact and consequences of indices without replicas

The absence of replicas can lead to the following impacts:

1. Data loss: In the event of data corruption or loss of a data node, a replica shard would be promoted to become the primary shard. Without replicas, this will not happen, and you may need to restore the index from a snapshot (if available).

2. Search latency: Replicas provide alternative sources of data to balance the load of search operations across the nodes in the cluster. Without replicas, search operations may experience increased latency as they have no alternative sources of data.

How to resolve

To resolve the issue of indices having no replicas, follow these recommendations:

1. Add a data node: If your cluster has only one data node, consider adding more data nodes to distribute the load and allow for replica creation.

2. Add replicas for indices: Update the index settings to include replicas. You can do this using the following command:

PUT /_all/_settings
{
  "index" : {
    "number_of_replicas" : 1
  }
}

This command sets the number of replicas to 1 for all indices. You can replace “_all” with a specific index name if you want to update the replica count for a particular index. 

Generally, you don’t need to add replicas to indices located on cold and frozen nodes as those indices are sourced from snapshots and if a primary shard goes missing it can easily be restored from the snapshot. Also, those cold and frozen indices are usually not searched very frequently, and hence, don’t need to be highly available.

Conclusion

By addressing this issue and ensuring that your indices have replicas, you can prevent data loss and maintain optimal search performance in your Elasticsearch cluster.

How helpful was this guide?

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?