# Setting default number of replicas for new indexes

**URL:** https://discuss.elastic.co/t/setting-default-number-of-replicas-for-new-indexes/47782
**Category:** Elasticsearch
**Created:** [April 19, 2016, 11:40am UTC](https://discuss.elastic.co/t/setting-default-number-of-replicas-for-new-indexes/47782 "2016-04-19T11:40:33Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![dandrestor](https://avatars.discourse-cdn.com/v4/letter/d/7cd45c/32.png) [@dandrestor](https://discuss.elastic.co/u/dandrestor)
#### Post date: [April 19, 2016, 11:40am UTC](https://discuss.elastic.co/t/setting-default-number-of-replicas-for-new-indexes/47782/1 "2016-04-19T11:40:34Z")

</div>

Hello,

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,  
Dan

---

<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: [April 19, 2016, 11:41am UTC](https://discuss.elastic.co/t/setting-default-number-of-replicas-for-new-indexes/47782/2 "2016-04-19T11:41:39Z")

</div>

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

---

<div class="post-metadata">

### Author: ![dandrestor](https://avatars.discourse-cdn.com/v4/letter/d/7cd45c/32.png) [@dandrestor](https://discuss.elastic.co/u/dandrestor)
#### Post date: [April 19, 2016, 11:50am UTC](https://discuss.elastic.co/t/setting-default-number-of-replicas-for-new-indexes/47782/3 "2016-04-19T11:50:02Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![thn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thn/32/8061_2.png) [@thn](https://discuss.elastic.co/u/thn)
#### Post date: [April 19, 2016, 12:26pm UTC](https://discuss.elastic.co/t/setting-default-number-of-replicas-for-new-indexes/47782/4 "2016-04-19T12:26:07Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![dandrestor](https://avatars.discourse-cdn.com/v4/letter/d/7cd45c/32.png) [@dandrestor](https://discuss.elastic.co/u/dandrestor)
#### Post date: [April 21, 2016, 7:27am UTC](https://discuss.elastic.co/t/setting-default-number-of-replicas-for-new-indexes/47782/5 "2016-04-21T07:27:02Z")

</div>

> [@thn](#):
>
> set it in the elasticsearch.yml file and restart ES

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`

---

<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:57pm UTC](https://discuss.elastic.co/t/setting-default-number-of-replicas-for-new-indexes/47782/6 "2017-07-05T22:57:28Z")

</div>


