Setting default number of replicas for new indexes


I'm running a small test installation and I would like to disable replicas. I was able to set the number of replicas to 0 for all existing indexes/shards, using /_settings, but newly created indexes have the old default value of 1. How can I change this value for new indexes also?

Many thanks,

1 Like

Is there an index template with a replica setting of one that applies to the indexes you create?

Not unless one is created by default on installation.

Update: I checked, as far as I can tell the answer is no. There is a template that applies to the indexes being created (we're talking about logstash here), but it doesn't include a replica setting.

For your own testing environment, if you prefer to have 0 replicas for all indices then set it in the elasticsearch.yml file and restart ES. You can also set the number of shards in this file too.

For other cases, I suggest to create a template for each index so you can control both the number of shards and replicas before creating a new index. In the template, you can also set the alias so that all related time series indices can have the same prefix and are also a part of an alias. Just load the template once.

1 Like

Thanks, this worked.

For completeness' sake, I was able to change the default by adding the following to elasticsearch.yml:
index.number_of_replicas: 0