Updating number of replicas to for indices – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 6.8-8.9

Briefly, this error occurs when there’s an attempt to update the number of replicas for indices in Elasticsearch, but the new number is not specified or is invalid. This could be due to a syntax error or a misconfiguration. To resolve this issue, ensure that the number of replicas is correctly specified and is a valid integer. Also, check the cluster health and ensure that there are enough nodes to accommodate the new number of replicas. If not, add more nodes or reduce the number of replicas.

We recommend you run the Elasticsearch Error Check-Up which can resolve issues that cause many errors.

This guide will help help you understand why the log “Updating number_of_replicas to for indices” has appeared and how to resolve it. It’s also important to understand the issues related to the log, so you can read the general overview on common issues and tips related to these Elasticsearch concepts below: allocation, cluster, indices and routing.


Elasticsearch replica shards can be updated dynamically both manually (by hitting API) or dynamically (based on the number of nodes and configuration) in order to improve search latency. A change in the number of replicas is a critical event, and Elasticsearch logs this event as below:

updating number_of_replicas to {new replicas number} for indices {affected indices list}.

Manual update 

Using Index update setting for existing indices or Index template for a future index. You can update the replica count of an existing index using the update index setting API as shown below. 

PUT /my-index/_settings
  "index" : {
    "number_of_replicas" : 2 // replica count

Dynamic update 

It’s common to upscale and downscale Elasticsearch clusters based on traffic, and for the same reason, having a fixed number of replicas isn’t very useful in cases like these. That’s why Elasticsearch came up with the concept of index.auto_expand_replicas(default false), which can dynamically increase/decrease the number of replicas based on the configuration and number of nodes in the cluster. 


If configured (0-5), the number of allocated replicas will match the number of nodes you create. If you increase/decrease, these numbers will also be changed accordingly.

Bottom line: 

This log is solely for information purposes and there’s nothing much to worry about with them, but if it changes without your knowledge, there is a scope to of appropriate actions to take, such as:

Changing the index template to make sure all future indices are not created with fixed settings,


index.auto_expand_replicas : false

Log Context

Log “updating number_of_replicas to [{}] for indices {}” classname is AllocationService.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

                    final IndexMetadata.Builder indexMetadataBuilder = new IndexMetadata.Builder(indexMetadata).settingsVersion(
                        1 + indexMetadata.getSettingsVersion()
                logger.info("updating number_of_replicas to [{}] for indices {}"; numberOfReplicas; indices);
            final ClusterState fixedState = ClusterState.builder(clusterState)


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?