# Setting default number of replicas for new indexes?

**URL:** https://discuss.elastic.co/t/setting-default-number-of-replicas-for-new-indexes/350835
**Category:** Elasticsearch
**Created:** [January 11, 2024, 8:30am UTC](https://discuss.elastic.co/t/setting-default-number-of-replicas-for-new-indexes/350835 "2024-01-11T08:30:28Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![emoxam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/emoxam/32/125661_2.png) [@emoxam](https://discuss.elastic.co/u/emoxam)
#### Post date: [January 11, 2024, 8:30am UTC](https://discuss.elastic.co/t/setting-default-number-of-replicas-for-new-indexes/350835/1 "2024-01-11T08:30:28Z")

</div>

addidng index.number\_of\_replicas: 0 to /etc/elasticsearch/elasticsearch.yml doesn't work. With this option elasticsearch doesn't start.  
at the log i see  
`fatal exception while booting Elasticsearch java.lang.IllegalArgumentException: node settings must not contain any index level settings`

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [January 11, 2024, 8:35am UTC](https://discuss.elastic.co/t/setting-default-number-of-replicas-for-new-indexes/350835/2 "2024-01-11T08:35:09Z")

</div>

You need to do this through an index template.

---

<div class="post-metadata">

### Author: ![emoxam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/emoxam/32/125661_2.png) [@emoxam](https://discuss.elastic.co/u/emoxam)
#### Post date: [January 11, 2024, 8:41am UTC](https://discuss.elastic.co/t/setting-default-number-of-replicas-for-new-indexes/350835/3 "2024-01-11T08:41:33Z")

</div>

> [@emoxam](#):
>
> index.number\_of\_replicas: 0

With this ?  
`{"number_of_replicas":0}`

---

<div class="post-metadata">

### Author: ![emoxam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/emoxam/32/125661_2.png) [@emoxam](https://discuss.elastic.co/u/emoxam)
#### Post date: [January 12, 2024, 9:09am UTC](https://discuss.elastic.co/t/setting-default-number-of-replicas-for-new-indexes/350835/4 "2024-01-12T09:09:12Z")

</div>

I think i can use

> {  
> "index": {  
> "lifecycle": {  
> "name": "logstash-policy",  
> "rollover\_alias": "actions-logs"  
> },  
> "number\_of\_replicas": "0"  
> }  
> }

---

<div class="post-metadata">

### Author: ![yago82](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yago82/32/97755_2.png) [@yago82](https://discuss.elastic.co/u/yago82)
#### Post date: [January 12, 2024, 4:49pm UTC](https://discuss.elastic.co/t/setting-default-number-of-replicas-for-new-indexes/350835/5 "2024-01-12T16:49:49Z")

</div>

> [@emoxam](#):
>
> addidng index.number\_of\_replicas: 0 to /etc/elasticsearch/elasticsearch.yml doesn't work. With this option elasticsearch doesn't start.  
> at the log i see  
> `fatal exception while booting Elasticsearch java.lang.IllegalArgumentException: node settings must not contain any index level settings`

Hi,

If you want to set the number of replicas for an index, you have a few options:

1. You can specify it when you create the index:

```auto
PUT /my-index-000001
{
  "settings": {
    "number_of_replicas": 0
  }
}

```

1. You can update it for an existing index:

```auto
PUT /my-index-000001/_settings
{
  "number_of_replicas": 0
}

```

Regards

---

<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: [February 9, 2024, 4:50pm UTC](https://discuss.elastic.co/t/setting-default-number-of-replicas-for-new-indexes/350835/6 "2024-02-09T16:50:19Z")

</div>

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