# Unassigned replica shards with reason as INDEX\_CREATED

**URL:** <https://discuss.elastic.co/t/unassigned-replica-shards-with-reason-as-index-created/237845>\
**Category:** Elasticsearch\
**Created:** [June 19, 2020, 6:03pm UTC](https://discuss.elastic.co/t/unassigned-replica-shards-with-reason-as-index-created/237845 "2020-06-19T18:03:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aliasgar\_Choolawala](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aliasgar_choolawala/32/45836_2.png) [@Aliasgar\_Choolawala](https://discuss.elastic.co/u/Aliasgar_Choolawala)\
**Post date:** [June 19, 2020, 6:03pm UTC](https://discuss.elastic.co/t/unassigned-replica-shards-with-reason-as-index-created/237845/1 "2020-06-19T18:03:34Z")

</div>

can anyone please help me ?  
i have a 7 data node elasticsearch cluster(5 master nodes)

for an index, i have the following settings for routing:

```auto
"routing" : {
          "allocation" : {
            "require" : {
              "box_type" : "hot"
            },
            "total_shards_per_node" : "1"
          }
        },
        "refresh_interval" : "120s",
        "number_of_shards" : "7",
        "translog" : {
          "flush_threshold_size" : "1g",
          "retention" : {
            "size" : "1g"
          }
        },
"number_of_replicas" : "1",

```

all the replicas are UNASSIGNED with reason as "INDEX\_CREATED" :

```auto
{
              "state" : "UNASSIGNED",
              "primary" : false,
              "node" : null,
              "relocating_node" : null,
              "shard" : 6,
              "index" : "pm2-logs-2020.06.19-000104",
              "recovery_source" : {
                "type" : "PEER"
              },
              "unassigned_info" : {
                "reason" : "INDEX_CREATED",
                "at" : "2020-06-19T14:01:38.699Z",
                "delayed" : false,
                "allocation_status" : "no_attempt"
              }
            }

```

---

<div class="post-metadata">

**Author:** ![Vinayak\_Sapre](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vinayak_sapre/32/45939_2.png) [@Vinayak\_Sapre](https://discuss.elastic.co/u/Vinayak_Sapre)\
**Post date:** [June 20, 2020, 4:24am UTC](https://discuss.elastic.co/t/unassigned-replica-shards-with-reason-as-index-created/237845/2 "2020-06-20T04:24:59Z")

</div>

Hi Aliasgar,

Your index has 7 shards and 1 replica that makes 14 shards to allocate. Since total\_shards\_per\_node is 1, you will need 14 data nodes, you have only 7 data nodes.

---

<div class="post-metadata">

**Author:** ![Aliasgar\_Choolawala](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aliasgar_choolawala/32/45836_2.png) [@Aliasgar\_Choolawala](https://discuss.elastic.co/u/Aliasgar_Choolawala)\
**Post date:** [June 22, 2020, 6:52am UTC](https://discuss.elastic.co/t/unassigned-replica-shards-with-reason-as-index-created/237845/3 "2020-06-22T06:52:01Z")

</div>

thanks for your suggestion, @Vinayak_Sapre  
i'll update the template settings

---

<div class="post-metadata">

**Author:** ![Aliasgar\_Choolawala](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aliasgar_choolawala/32/45836_2.png) [@Aliasgar\_Choolawala](https://discuss.elastic.co/u/Aliasgar_Choolawala)\
**Post date:** [June 23, 2020, 1:15pm UTC](https://discuss.elastic.co/t/unassigned-replica-shards-with-reason-as-index-created/237845/4 "2020-06-23T13:15:32Z")

</div>

hey @Vinayak_Sapre

after i made changes for total\_shards\_per\_node, still out of 14 shards, one replica shard remains unassigned after index rollover.

this is not happening after every rollover, but happening frequently!

```auto
"6" : [
            {
              "state" : "STARTED",
              "primary" : true,
              "node" : "xxxxxxxxxxxxxxxx",
              "relocating_node" : null,
              "shard" : 6,
              "index" : "pm2-logs-2020.06.23-000172",
              "allocation_id" : {
                "id" : "xxxxxxxxxxxxxxxx"
              }
            },
            {
              "state" : "UNASSIGNED",
              "primary" : false,
              "node" : null,
              "relocating_node" : null,
              "shard" : 6,
              "index" : "pm2-logs-2020.06.23-000172",
              "recovery_source" : {
                "type" : "PEER"
              },
              "unassigned_info" : {
                "reason" : "INDEX_CREATED",
                "at" : "2020-06-23T10:41:38.561Z",
                "delayed" : false,
                "allocation_status" : "no_attempt"
              }
            }
          ]

```

and due to this, the index status remains yellow, and is not green

---

<div class="post-metadata">

**Author:** ![Aliasgar\_Choolawala](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aliasgar_choolawala/32/45836_2.png) [@Aliasgar\_Choolawala](https://discuss.elastic.co/u/Aliasgar_Choolawala)\
**Post date:** [June 24, 2020, 1:48pm UTC](https://discuss.elastic.co/t/unassigned-replica-shards-with-reason-as-index-created/237845/5 "2020-06-24T13:48:28Z")

</div>

i managed to overcome this issue, by assigning "total\_shards\_per\_node" as 3 instead of 2, since I noticed that while the rollover happens, the deletion and creation of replica shard(s) happens in parallel, and so at some point of time, one of the node(s) might have more than 2 shards for the index.

After changing the value to 3, now all the rollover indices are green.

I managed to get to this answer by this

```auto
 {
          "decider" : "awareness",
          "decision" : "NO",
          "explanation" : "there are too many copies of the shard allocated to nodes with attribute [aws_availability_zone], there are [2] total configured shard copies for this shard id and [3] total attribute values, expected the allocated shard count per attribute [2] to be less than or equal to the upper bound of the required number of shards per attribute [1]"
        }

```

which is a part of the output of the query:

```auto
GET /_cluster/allocation/explain
{
  "index": "pm2-logs-2020.06.23-000186",
  "shard": 6,
  "primary": false
}

```

---

<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 22, 2020, 1:48pm UTC](https://discuss.elastic.co/t/unassigned-replica-shards-with-reason-as-index-created/237845/6 "2020-07-22T13:48:35Z")

</div>

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