# Number of Replicas is always 1 by default

**URL:** https://discuss.elastic.co/t/number-of-replicas-is-always-1-by-default/148064
**Category:** Elasticsearch
**Created:** [September 11, 2018, 6:54am UTC](https://discuss.elastic.co/t/number-of-replicas-is-always-1-by-default/148064 "2018-09-11T06:54:35Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![cawoodm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cawoodm/32/14083_2.png) [@cawoodm](https://discuss.elastic.co/u/cawoodm)
#### Post date: [September 11, 2018, 6:54am UTC](https://discuss.elastic.co/t/number-of-replicas-is-always-1-by-default/148064/1 "2018-09-11T06:54:35Z")

</div>

All our indices were "yellow" and we discovered it's because the number of replicas was set to 1. When we update the number of replicas to 0 the indexes are green.

Because we periodically re-create our indices and re-index them we added the following to our index creation:

```
{
    "index" : {
        "number_of_replicas" : 0
    },
    "mappings": {
        "doc": {
            "properties": {
                ...

```

However, such indices are still created with number\_of\_replicas = 1 as is visible in: `GET /_cat/indices`:

```
health status index uuid pri rep docs.count
yellow open logs-test1 ... 5 1 3316531 

```

1. Why does ES set 1 by default? Sounds wrong.
2. Why does ES ignore the 0 when we create the index?

---

<div class="post-metadata">

### Author: ![shrikantgulia](https://avatars.discourse-cdn.com/v4/letter/s/c68b51/32.png) [@shrikantgulia](https://discuss.elastic.co/u/shrikantgulia)
#### Post date: [September 11, 2018, 6:57am UTC](https://discuss.elastic.co/t/number-of-replicas-is-always-1-by-default/148064/2 "2018-09-11T06:57:17Z")

</div>

It is because the default is always one  
as you are only having one instance thats why the status is yellow

---

<div class="post-metadata">

### Author: ![cawoodm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cawoodm/32/14083_2.png) [@cawoodm](https://discuss.elastic.co/u/cawoodm)
#### Post date: [September 11, 2018, 6:59am UTC](https://discuss.elastic.co/t/number-of-replicas-is-always-1-by-default/148064/3 "2018-09-11T06:59:28Z")

</div>

Why is the default 1? =\> Because it is 1. OK, that's cleared that up for us.

---

<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: [September 11, 2018, 7:03am UTC](https://discuss.elastic.co/t/number-of-replicas-is-always-1-by-default/148064/4 "2018-09-11T07:03:28Z")

</div>

Please show exactly how you create the index.

---

<div class="post-metadata">

### Author: ![cawoodm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cawoodm/32/14083_2.png) [@cawoodm](https://discuss.elastic.co/u/cawoodm)
#### Post date: [September 11, 2018, 8:02am UTC](https://discuss.elastic.co/t/number-of-replicas-is-always-1-by-default/148064/5 "2018-09-11T08:02:42Z")

</div>

```
PUT /logs-test1

{
    "index" : {
        "number_of_replicas" : 0
    },
    "mappings": {
        "doc": {
            "properties": {
                "category": {"type": "keyword"},
                "id": {"type": "long"},
                "subcategory": {"type": "keyword"},
                "timestamp": {"type": "date","format": "date_time||epoch_millis"},
                "type": {"type": "keyword"}
            }
        }
    }
}
```

---

<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: [September 11, 2018, 8:09am UTC](https://discuss.elastic.co/t/number-of-replicas-is-always-1-by-default/148064/6 "2018-09-11T08:09:39Z")

</div>

You are missing the `settings` level, which is why your settings are not recognised:

```auto
PUT /logs-test1
{
  "settings": {
    "index" : {
      "number_of_replicas" : 0
    }
  },
  "mappings": {
    "doc": {
      "properties": {
        "category": {"type": "keyword"},
        "id": {"type": "long"},
        "subcategory": {"type": "keyword"},
        "timestamp": {"type": "date","format": "date_time||epoch_millis"},
        "type": {"type": "keyword"}
      }
    }
  }
}

```

---

<div class="post-metadata">

### Author: ![cawoodm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cawoodm/32/14083_2.png) [@cawoodm](https://discuss.elastic.co/u/cawoodm)
#### Post date: [September 11, 2018, 8:21am UTC](https://discuss.elastic.co/t/number-of-replicas-is-always-1-by-default/148064/7 "2018-09-11T08:21:32Z")

</div>

Thanks muchly!

---

<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: [October 9, 2018, 8:21am UTC](https://discuss.elastic.co/t/number-of-replicas-is-always-1-by-default/148064/8 "2018-10-09T08:21:35Z")

</div>

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