Note: Aiven for OpenSearch replaces Aiven for Elasticsearch after Elasticsearch version 7.10.2 due to licensing changes. In addition, OpenSearch Dashboards replaces Kibana. Starting from September 24th, 2021 until March 23rd, 2022, Aiven supports services running both OpenSearch and Elasticsearch 7.10.2. For more information on Aiven for OpenSearch, see our developer documentation.

Aiven for Elasticsearch automatically adjusts index replication factors to ensure data availability and service functionality.

When replication factor is automatically adjusted?

  • If number_of_replicas is too large for current cluster size, it is automatically lowered to maximum possible value (number of nodes on the cluster - 1).

  • If number_of_replicas  is 0 on a multi-node cluster, it is automatically increased to 1.

  • If number_of_replicas  is anywhere between 1 and maximum value, it is not automatically adjusted.

Lowering replication factor

When replication factor (number_of_replicas ) is set to larger than size of the cluster, number_of_replicas  is automatically lowered, as it is not possible to replicate indexes (shards) to a larger number of nodes than what exists on the cluster. Do note number replication factor is number_of_replicas  + 1. For example, for three-node cluster, maximum number_of_replicas  is 2, which means all shards on the index are replicated to all three nodes.

Increasing replication factor

For multi-node clusters, Aiven for Elasticsearch automatically increases number_of_replicas  to 1, if it is set to 0. This is to ensure no data-loss occurs if one node is lost.

Consider disabling this if

  • You are running out of disk space, but you don't need more CPU or memory capacity.

  • You can easily regenerate all the data on the indexes that will have number_of_replicas = 1 .

  • You are running a multi-node cluster.

To disable automatic increase of number_of_replicas , install Aiven command-line client, and run following command:

avn service update -c disable_replication_factor_adjustment=true <your service name> 

This will not lower number_of_replicas , but in the future it will not be increased automatically. Replication factor is still automatically lowered when set to larger value than current cluster configuration allows.

Got here by accident? Learn how Aiven simplifies working with Elasticsearch:

Did this answer your question?