Default Number Of Replicas for new indices

Hi there - I have searched all manner of online resources but can't seem to
find an answer to:

How do I change the default number of replicas for new indices in my ES
cluster?

I am running a single node cluster in development, and want to stop it from
creating unallocated replica shards which causes the cluster state to be
amber. I currently change the number of replicas setting for each index
individually.. is there a default I can set to 0 somewhere?

Thanks!

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/8420f685-d07d-4694-bc96-6b7ade96e5d8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

2 Likes

On Wednesday, March 11, 2015 at 10:56 CET,
Matt Stibbs mattstibbs@gmail.com wrote:

How do I change the default number of replicas for new indices in my ES
cluster?

The index.number_of_replicas setting in elasticsearch.yml controls this,
but it can be overridden by the corresponding dynamic setting. On top of
that, index templates can override both these options.

[...]

--
Magnus Bäck | Software Engineer, Development Tools
magnus.back@sonymobile.com | Sony Mobile Communications

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/20150311105820.GC31552%40seldlx20533.corpusers.net.
For more options, visit https://groups.google.com/d/optout.

1 Like

Great thanks!

I hadn't realised there were indices-templates - sometimes you can't see
the wood for the trees.

Editing elasticsearch.yml did the trick though.

On Wednesday, 11 March 2015 10:58:42 UTC, Magnus Bäck wrote:

On Wednesday, March 11, 2015 at 10:56 CET,
Matt Stibbs <matts...@gmail.com <javascript:>> wrote:

How do I change the default number of replicas for new indices in my ES
cluster?

The index.number_of_replicas setting in elasticsearch.yml controls this,
but it can be overridden by the corresponding dynamic setting. On top of
that, index templates can override both these options.

Update index settings API | Elasticsearch Guide [8.11] | Elastic

Index templates | Elasticsearch Guide [8.11] | Elastic

[...]

--
Magnus Bäck | Software Engineer, Development Tools
magnu...@sonymobile.com <javascript:> | Sony Mobile Communications

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/4c86419c-b627-4aef-93c0-794ffc9243a2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

In Elastic Search version 5, you will get the following error if you add the replica shards config in elasticsearch.yml & elasticsearch node fails to come up..

========================
Since elasticsearch 5.x index level settings can NOT be set on the nodes
configuration like the elasticsearch.yaml, in system properties or command line
arguments.In order to upgrade all indices the settings must be updated via the
/${index}/_settings API. Unless all settings are dynamic all indices must be closed
in order to apply the upgradeIndices created in the future should use index templates
to set default values.

Please ensure all required values are updated on all indices by executing:

curl -XPUT 'http://localhost:9200/_all/_settings?preserve_existing=true' -d '{
"index.number_of_replicas" : "2"
}'

=====

1 Like