# ES6.x - Prevent new index to be created with replica shards

**URL:** https://discuss.elastic.co/t/es6-x-prevent-new-index-to-be-created-with-replica-shards/178168
**Category:** Elasticsearch
**Created:** [April 24, 2019, 7:27am UTC](https://discuss.elastic.co/t/es6-x-prevent-new-index-to-be-created-with-replica-shards/178168 "2019-04-24T07:27:14Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![EldrosKandar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eldroskandar/32/33188_2.png) [@EldrosKandar](https://discuss.elastic.co/u/EldrosKandar)
#### Post date: [April 24, 2019, 7:27am UTC](https://discuss.elastic.co/t/es6-x-prevent-new-index-to-be-created-with-replica-shards/178168/1 "2019-04-24T07:27:14Z")

</div>

This issue appears on ES 6.7 with the Filebeat Client still being 6.2.

I've set the number of replicas to 0 with:

```
curl -XPUT "http://localhost:9200/_settings" -H 'Content-Type: application/json' -d'
{
    "index" : {
        "number_of_replicas" : 0
    }
}'

```

However, when a new index is created at the beginning of the days it gets one replica shard for each primary shards.

I've looked into the elasticsearch configuration and even in the Management Tab in Kibana, but could not find where I could set that new index would be created without any replica shards.

---

<div class="post-metadata">

### Author: ![Bernt\_Rostad](https://avatars.discourse-cdn.com/v4/letter/b/3ab097/32.png) [@Bernt\_Rostad](https://discuss.elastic.co/u/Bernt_Rostad)
#### Post date: [April 24, 2019, 7:56am UTC](https://discuss.elastic.co/t/es6-x-prevent-new-index-to-be-created-with-replica-shards/178168/2 "2019-04-24T07:56:41Z")

</div>

> [@EldrosKandar](#):
>
> could not find where I could set that new index would be created without any replica shards

Look at [Index Templates](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html) to set your default number\_of\_replicas (and shards) for new indices.

---

<div class="post-metadata">

### Author: ![EldrosKandar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eldroskandar/32/33188_2.png) [@EldrosKandar](https://discuss.elastic.co/u/EldrosKandar)
#### Post date: [May 13, 2019, 9:11am UTC](https://discuss.elastic.co/t/es6-x-prevent-new-index-to-be-created-with-replica-shards/178168/3 "2019-05-13T09:11:18Z")

</div>

> [@Bernt\_Rostad](#):
>
> Look at [Index Templates](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html) to set your default number\_of\_replicas (and shards) for new indices.

So I added the setting in the json configuration file, but the indices still are created with replica shards.

Now the filebeat client, together with the json and yml configuration are distributed through automation to all machines which feeds their log to the elasticsearch. To completely be sure that the changes didn't work, I'll have to track down which filebeat client triggered the creation of the index. (or either the host where the filebeat client is installed)

Is there a way to do that?

---

<div class="post-metadata">

### Author: ![EldrosKandar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eldroskandar/32/33188_2.png) [@EldrosKandar](https://discuss.elastic.co/u/EldrosKandar)
#### Post date: [May 13, 2019, 9:13am UTC](https://discuss.elastic.co/t/es6-x-prevent-new-index-to-be-created-with-replica-shards/178168/4 "2019-05-13T09:13:34Z")

</div>

By the way, as a workaround, I used a crontab task to execute a shell script setting the number of replica with a curl call.

As this is clunky, I don't want to keep that as my definitive answer, but I thought it might help someone having the same issue.

---

<div class="post-metadata">

### Author: ![EldrosKandar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eldroskandar/32/33188_2.png) [@EldrosKandar](https://discuss.elastic.co/u/EldrosKandar)
#### Post date: [May 14, 2019, 8:42am UTC](https://discuss.elastic.co/t/es6-x-prevent-new-index-to-be-created-with-replica-shards/178168/5 "2019-05-14T08:42:53Z")

</div>

@Bernt_Rostad

So I found out about the `auto_expand_replicas` setting from [this thread](https://discuss.elastic.co/t/change-number-of-replicas-to-0-on-existing-indices/141622) while searching something else. I've set it to `false` and I will see if it works tomorrow when the new index is created.

EDIT: Marking this as the solution, since then the cluster configuration changed so I needed the replicas, as such I couldn't test it thoroughly, but this is as close of a solution I came, and I hope it can help someone.

---

<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: [June 11, 2019, 8:42am UTC](https://discuss.elastic.co/t/es6-x-prevent-new-index-to-be-created-with-replica-shards/178168/6 "2019-06-11T08:42:56Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
