# Default Number Of Replicas for new indices

**URL:** https://discuss.elastic.co/t/default-number-of-replicas-for-new-indices/22612
**Category:** Elasticsearch
**Created:** [March 11, 2015, 9:56am UTC](https://discuss.elastic.co/t/default-number-of-replicas-for-new-indices/22612 "2015-03-11T09:56:21Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Matt\_Stibbs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matt_stibbs/32/842_2.png) [@Matt\_Stibbs](https://discuss.elastic.co/u/Matt_Stibbs)
#### Post date: [March 11, 2015, 9:56am UTC](https://discuss.elastic.co/t/default-number-of-replicas-for-new-indices/22612/1 "2015-03-11T09:56:21Z")

</div>

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](mailto: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](https://groups.google.com/d/msgid/elasticsearch/8420f685-d07d-4694-bc96-6b7ade96e5d8%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [March 11, 2015, 10:58am UTC](https://discuss.elastic.co/t/default-number-of-replicas-for-new-indices/22612/2 "2015-03-11T10:58:20Z")

</div>

On Wednesday, March 11, 2015 at 10:56 CET,  
Matt Stibbs [mattstibbs@gmail.com](mailto: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.

> **[Update index settings API | Elasticsearch Guide \[8.11\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-update-settings.html)**

> **[Index templates | Elasticsearch Guide \[8.11\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html)**

[...]

--  
Magnus Bäck | Software Engineer, Development Tools  
[magnus.back@sonymobile.com](mailto: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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/20150311105820.GC31552%40seldlx20533.corpusers.net](https://groups.google.com/d/msgid/elasticsearch/20150311105820.GC31552%40seldlx20533.corpusers.net).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![Matt\_Stibbs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matt_stibbs/32/842_2.png) [@Matt\_Stibbs](https://discuss.elastic.co/u/Matt_Stibbs)
#### Post date: [March 11, 2015, 3:11pm UTC](https://discuss.elastic.co/t/default-number-of-replicas-for-new-indices/22612/3 "2015-03-11T15:11:47Z")

</div>

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](mailto: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](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-update-settings.html)
> 
> [Index templates | Elasticsearch Guide [8.11] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html)
> 
> [...]
> 
> --  
> Magnus Bäck | Software Engineer, Development Tools  
> [magnu...@sonymobile.com](mailto: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](mailto: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](https://groups.google.com/d/msgid/elasticsearch/4c86419c-b627-4aef-93c0-794ffc9243a2%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![Jayanna\_Hallur](https://avatars.discourse-cdn.com/v4/letter/j/a4c791/32.png) [@Jayanna\_Hallur](https://discuss.elastic.co/u/Jayanna_Hallur)
#### Post date: [April 3, 2017, 5:26pm UTC](https://discuss.elastic.co/t/default-number-of-replicas-for-new-indices/22612/4 "2017-04-03T17:26:55Z")

</div>

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](http://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](http://localhost:9200/_all/_settings?preserve_existing=true)' -d '{  
"index.number\_of\_replicas" : "2"  
}'

=====

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 5, 2017, 10:01pm UTC](https://discuss.elastic.co/t/default-number-of-replicas-for-new-indices/22612/5 "2017-07-05T22:01:32Z")

</div>


