# Newly created index has unallocated shards

**URL:** <https://discuss.elastic.co/t/newly-created-index-has-unallocated-shards/70227>\
**Category:** Elasticsearch\
**Created:** [December 29, 2016, 5:39pm UTC](https://discuss.elastic.co/t/newly-created-index-has-unallocated-shards/70227 "2016-12-29T17:39:10Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![zozo6015](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zozo6015/32/12117_2.png) [@zozo6015](https://discuss.elastic.co/u/zozo6015)\
**Post date:** [December 29, 2016, 5:39pm UTC](https://discuss.elastic.co/t/newly-created-index-has-unallocated-shards/70227/1 "2016-12-29T17:39:10Z")

</div>

Hello,

I have a 3 node elasticsearch cluster. all where ok, but until I created a new index and the newly created index has unallocated shards,

core@client-cluster-1:~$ curl [http://localhost:19268/\_cat/shards?v](http://localhost:19268/_cat/shards?v)  
index shard prirep state docs store ip node  
site-id 3 p STARTED 0 159b 10.0.0.6 config.rets.ci-client-cluster-2  
site-id 3 r STARTED 0 159b 10.0.0.7 config.rets.ci-client-cluster-3  
site-id 4 p STARTED 0 159b 10.0.0.5 config.rets.ci-client-cluster-1  
site-id 4 r UNASSIGNED  
site-id 2 r STARTED 0 159b 10.0.0.5 config.rets.ci-client-cluster-1  
site-id 2 p STARTED 0 159b 10.0.0.7 config.rets.ci-client-cluster-3  
site-id 1 p STARTED 0 159b 10.0.0.5 config.rets.ci-client-cluster-1  
site-id 1 r UNASSIGNED  
site-id 0 p STARTED 0 159b 10.0.0.6 config.rets.ci-client-cluster-2  
site-id 0 r STARTED 0 159b 10.0.0.7 config.rets.ci-client-cluster-3

Please help me get back to green state.

Regards,  
Peter

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [December 29, 2016, 9:05pm UTC](https://discuss.elastic.co/t/newly-created-index-has-unallocated-shards/70227/2 "2016-12-29T21:05:25Z")

</div>

Do you have enough disk space on all the nodes?  
Check the master logs, it might say something.

---

<div class="post-metadata">

**Author:** ![zozo6015](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zozo6015/32/12117_2.png) [@zozo6015](https://discuss.elastic.co/u/zozo6015)\
**Post date:** [December 29, 2016, 9:33pm UTC](https://discuss.elastic.co/t/newly-created-index-has-unallocated-shards/70227/3 "2016-12-29T21:33:24Z")

</div>

More than enough space on all nodes. And nothing in the logs.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [December 29, 2016, 10:21pm UTC](https://discuss.elastic.co/t/newly-created-index-has-unallocated-shards/70227/4 "2016-12-29T22:21:42Z")

</div>

Well a quick fix would be to remove the replica set and readd it.

However you can also try a reroute on those two shards to see if it works, and if not, why they aren't being allocated.

---

<div class="post-metadata">

**Author:** ![zozo6015](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zozo6015/32/12117_2.png) [@zozo6015](https://discuss.elastic.co/u/zozo6015)\
**Post date:** [December 29, 2016, 10:31pm UTC](https://discuss.elastic.co/t/newly-created-index-has-unallocated-shards/70227/5 "2016-12-29T22:31:18Z")

</div>

would you mind telling me how to do any of those steps?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [December 29, 2016, 10:32pm UTC](https://discuss.elastic.co/t/newly-created-index-has-unallocated-shards/70227/6 "2016-12-29T22:32:38Z")

</div>

[https://www.elastic.co/guide/en/elasticsearch/guide/2.x/replica-shards.html](https://www.elastic.co/guide/en/elasticsearch/guide/2.x/replica-shards.html)  
[https://www.elastic.co/guide/en/elasticsearch/reference/5.1/cluster-reroute.html](https://www.elastic.co/guide/en/elasticsearch/reference/5.1/cluster-reroute.html)

---

<div class="post-metadata">

**Author:** ![zozo6015](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zozo6015/32/12117_2.png) [@zozo6015](https://discuss.elastic.co/u/zozo6015)\
**Post date:** [December 29, 2016, 10:42pm UTC](https://discuss.elastic.co/t/newly-created-index-has-unallocated-shards/70227/7 "2016-12-29T22:42:02Z")

</div>

Thanks,

I have tried removing the replicate then read it back and it goes straight back to unassigned mode.  
if I try rerouting the shard the documentation is showing a from\_node but since the shard is unassigned there is no from\_node.

---

<div class="post-metadata">

**Author:** ![ywelsch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ywelsch/32/7751_2.png) [@ywelsch](https://discuss.elastic.co/u/ywelsch)\
**Post date:** [December 30, 2016, 1:32pm UTC](https://discuss.elastic.co/t/newly-created-index-has-unallocated-shards/70227/8 "2016-12-30T13:32:05Z")

</div>

Which ES version is this? If \>= v5.0.0, have a look at the [cluster allocation explain API](https://www.elastic.co/guide/en/elasticsearch/reference/5.1/cluster-allocation-explain.html)

---

<div class="post-metadata">

**Author:** ![zozo6015](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zozo6015/32/12117_2.png) [@zozo6015](https://discuss.elastic.co/u/zozo6015)\
**Post date:** [December 30, 2016, 1:47pm UTC](https://discuss.elastic.co/t/newly-created-index-has-unallocated-shards/70227/9 "2016-12-30T13:47:26Z")

</div>

elasticsearch version is 2.3.4

---

<div class="post-metadata">

**Author:** ![ywelsch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ywelsch/32/7751_2.png) [@ywelsch](https://discuss.elastic.co/u/ywelsch)\
**Post date:** [December 30, 2016, 1:56pm UTC](https://discuss.elastic.co/t/newly-created-index-has-unallocated-shards/70227/10 "2016-12-30T13:56:17Z")

</div>

What's the output of running

```auto
curl -XPOST 'localhost:9200/_cluster/reroute' -d '{
    "commands" : [ {
        {
          "allocate_replica" : {
              "index" : "site-id", "shard" : 1, "node" : "config.rets.ci-client-cluster-2"
          }
        }
    ]
}'

```

what if you run the same command for `config.rets.ci-client-cluster-3`?

---

<div class="post-metadata">

**Author:** ![zozo6015](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zozo6015/32/12117_2.png) [@zozo6015](https://discuss.elastic.co/u/zozo6015)\
**Post date:** [December 30, 2016, 3:13pm UTC](https://discuss.elastic.co/t/newly-created-index-has-unallocated-shards/70227/11 "2016-12-30T15:13:38Z")

</div>

> [@ywelsch](#):
>
> "commands" : [ {  
> {  
> "allocate\_replica" : {  
> "index" : "site-id", "shard" : 1, "node" : "config.rets.ci-client-cluster-2"  
> }  
> }  
> ]  
> }'

```
core@client-cluster-1:~$ curl -XPOST 'localhost:19268/_cluster/reroute' -d '{
"commands" : [ {

```

> ```
> {
> "allocate_replica" : {
> "index" : "site-id", "shard" : 1, "node" : "config.rets.ci-client-cluster-2"
> }
> }
> ]
> 
> ```
> 
> }'  
> {"error":{"root\_cause":[{"type":"json\_parse\_exception","reason":"Unexpected character ('{' (code 123)): was expecting either valid name character (for unquoted name) or double-quote (for quoted) to start field name\n at [Source: org.elasticsearch.transport.netty.ChannelBufferStreamInput@469fd885; line: 3, column: 10]"}],"type":"json\_parse\_exception","reason":"Unexpected character ('{' (code 123)): was expecting either valid name character (for unquoted name) or double-quote (for quoted) to start field name\n at [Source: org.elasticsearch.transport.netty.ChannelBufferStreamInput@469fd885; line: 3, column: 10]"},"status":500}core@

---

<div class="post-metadata">

**Author:** ![ywelsch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ywelsch/32/7751_2.png) [@ywelsch](https://discuss.elastic.co/u/ywelsch)\
**Post date:** [December 30, 2016, 3:31pm UTC](https://discuss.elastic.co/t/newly-created-index-has-unallocated-shards/70227/12 "2016-12-30T15:31:33Z")

</div>

yeah, had some typos, correct one is

```auto
curl -XPOST 'localhost:9200/_cluster/reroute' -d '{
    "commands" : [
        {
          "allocate" : {
              "index" : "site-id", "shard" : 1, "node" : "config.rets.ci-client-cluster-2"
          }
        }
    ]
}'

```

---

<div class="post-metadata">

**Author:** ![zozo6015](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zozo6015/32/12117_2.png) [@zozo6015](https://discuss.elastic.co/u/zozo6015)\
**Post date:** [December 30, 2016, 4:53pm UTC](https://discuss.elastic.co/t/newly-created-index-has-unallocated-shards/70227/13 "2016-12-30T16:53:51Z")

</div>

> [@ywelsch](#):
>
> "commands" : [  
> {  
> "allocate" : {  
> "index" : "site-id", "shard" : 1, "node" : "config.rets.ci-client-cluster-2"  
> }  
> }  
> ]  
> }'

I got a different error:  
{"error":{"root\_cause":[{"type":"remote\_transport\_exception","reason":"[config.rets.ci-client-cluster-2][10.0.0.6:19368][cluster:admin/reroute]"}],"type":"illegal\_argument\_exception","reason":"[allocate] allocation of [site-id][1] on node {config.rets.ci-client-cluster-2}{JWGyMaFESxWE-xsy1baMhQ}{10.0.0.6}{10.0.0.6:19368} is not allowed, reason: [YES(allocation disabling is ignored)][YES(allocation disabling is ignored)][YES(shard is not allocated to same node or host)][YES(shard not primary or relocation disabled)][YES(no allocation awareness enabled)][YES(enough disk for shard on node, free: [386.3gb])][YES(primary is already active)][YES(total shard limit disabled: [index: -1, cluster: -1] \<= 0)][YES(node passes include/exclude/require filters)][NO(target node version [2.3.3] is older than source node version [2.3.4])][YES(below shard recovery limit of [2])]"},"status":400}

---

<div class="post-metadata">

**Author:** ![ywelsch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ywelsch/32/7751_2.png) [@ywelsch](https://discuss.elastic.co/u/ywelsch)\
**Post date:** [December 30, 2016, 5:07pm UTC](https://discuss.elastic.co/t/newly-created-index-has-unallocated-shards/70227/14 "2016-12-30T17:07:45Z")

</div>

> [@zozo6015](#):
>
> target node version [2.3.3] is older than source node version [2.3.4]

There you have your answer though. You have a mixed-version cluster (some nodes have ES v2.3.3 and others ES v2.3.4). Having a primary shard on a newer node does not allow the replica to be allocated to an older node. Upgrade all nodes to the same version.

---

<div class="post-metadata">

**Author:** ![zozo6015](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zozo6015/32/12117_2.png) [@zozo6015](https://discuss.elastic.co/u/zozo6015)\
**Post date:** [December 30, 2016, 8:16pm UTC](https://discuss.elastic.co/t/newly-created-index-has-unallocated-shards/70227/15 "2016-12-30T20:16:17Z")

</div>

I have downgraded the node which was different from the others now the cluster is red. With alot of unassigned shards.

```
curl http://localhost:19268/_cluster/health?pretty
 {
   "cluster_name" : "config.rets.ci",
   "status" : "red",
   "timed_out" : false,
   "number_of_nodes" : 3,
   "number_of_data_nodes" : 3,
   "active_primary_shards" : 6,
   "active_shards" : 12,
   "relocating_shards" : 0,
   "initializing_shards" : 0,
   "unassigned_shards" : 8,
   "delayed_unassigned_shards" : 0,
   "number_of_pending_tasks" : 0,
   "number_of_in_flight_fetch" : 0,
   "task_max_waiting_in_queue_millis" : 0,
   "active_shards_percent_as_number" : 60.0
 }

curl http://localhost:19268/_cat/shards
site-id 4 p UNASSIGNED                                                 
site-id 4 r UNASSIGNED                                                 
site-id 1 p UNASSIGNED                                                 
site-id 1 r UNASSIGNED                                                 
site-id 3 p STARTED 0 159b 10.0.0.6 config.rets.ci-client-cluster-2 
site-id 3 r STARTED 0 159b 10.0.0.7 config.rets.ci-client-cluster-3 
site-id 2 r STARTED 0 159b 10.0.0.6 config.rets.ci-client-cluster-2 
site-id 2 p STARTED 0 159b 10.0.0.7 config.rets.ci-client-cluster-3 
site-id 0 r STARTED 0 159b 10.0.0.6 config.rets.ci-client-cluster-2 
site-id 0 p STARTED 0 159b 10.0.0.7 config.rets.ci-client-cluster-3 
subscription 4 p UNASSIGNED                                                 
subscription 4 r UNASSIGNED                                                 
subscription 1 p UNASSIGNED                                                 
subscription 1 r UNASSIGNED                                                 
subscription 3 p STARTED 0 159b 10.0.0.6 config.rets.ci-client-cluster-2 
subscription 3 r STARTED 0 159b 10.0.0.7 config.rets.ci-client-cluster-3 
subscription 2 r STARTED 0 159b 10.0.0.6 config.rets.ci-client-cluster-2 
subscription 2 p STARTED 0 159b 10.0.0.7 config.rets.ci-client-cluster-3 
subscription 0 p STARTED 0 159b 10.0.0.6 config.rets.ci-client-cluster-2 
subscription 0 r STARTED 0 159b 10.0.0.7 config.rets.ci-client-cluster-3
```

---

<div class="post-metadata">

**Author:** ![zozo6015](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zozo6015/32/12117_2.png) [@zozo6015](https://discuss.elastic.co/u/zozo6015)\
**Post date:** [December 30, 2016, 9:58pm UTC](https://discuss.elastic.co/t/newly-created-index-has-unallocated-shards/70227/16 "2016-12-30T21:58:29Z")

</div>

Managed to fix it finally. After stopping two out of the 3 nodes relocating the unassigned shards on the online node. Then restarted the nodes one by one.

Thanks for your help.

---

<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:** [January 27, 2017, 9:58pm UTC](https://discuss.elastic.co/t/newly-created-index-has-unallocated-shards/70227/17 "2017-01-27T21:58:37Z")

</div>

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