# Force reroute all unassigned shards

**URL:** <https://discuss.elastic.co/t/force-reroute-all-unassigned-shards/68596>\
**Category:** Elasticsearch\
**Created:** [December 9, 2016, 6:56pm UTC](https://discuss.elastic.co/t/force-reroute-all-unassigned-shards/68596 "2016-12-09T18:56:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![niraj\_kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/niraj_kumar/32/4130_2.png) [@niraj\_kumar](https://discuss.elastic.co/u/niraj_kumar)\
**Post date:** [December 9, 2016, 6:56pm UTC](https://discuss.elastic.co/t/force-reroute-all-unassigned-shards/68596/1 "2016-12-09T18:56:53Z")

</div>

Hi All,

I have an ES cluster with 3 nodes and ES version 2.4.1. I have around 2000 shards in UNASSIGNED state. Is there a way where i can force assign all of them?

And what is the best way to avoid this.

--  
Niraj

---

<div class="post-metadata">

**Author:** ![xavierfacq](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xavierfacq/32/8744_2.png) [@xavierfacq](https://discuss.elastic.co/u/xavierfacq)\
**Post date:** [December 9, 2016, 9:10pm UTC](https://discuss.elastic.co/t/force-reroute-all-unassigned-shards/68596/2 "2016-12-09T21:10:30Z")

</div>

Hi, can you tell us how many indices and replicas you have ?

---

<div class="post-metadata">

**Author:** ![suanmeiguo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/suanmeiguo/32/11758_2.png) [@suanmeiguo](https://discuss.elastic.co/u/suanmeiguo)\
**Post date:** [December 10, 2016, 12:09am UTC](https://discuss.elastic.co/t/force-reroute-all-unassigned-shards/68596/3 "2016-12-10T00:09:15Z")

</div>

And what is the data size.

wow 2000 unassigned, sounds like you have a lot of shards (assigned+unassigned).

---

<div class="post-metadata">

**Author:** ![niraj\_kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/niraj_kumar/32/4130_2.png) [@niraj\_kumar](https://discuss.elastic.co/u/niraj_kumar)\
**Post date:** [December 10, 2016, 12:12am UTC](https://discuss.elastic.co/t/force-reroute-all-unassigned-shards/68596/4 "2016-12-10T00:12:21Z")

</div>

I have fixed my issue. The issue was related to my disk on root being full to 95% so elasticsearch was not processing further shard allocation. Once i added additional space to my disk , it works perfectly fine.

yeah it is a bigdata consisting of around 600 amazon account's cloudtrail logs.

---

<div class="post-metadata">

**Author:** ![KlopgeestBE](https://avatars.discourse-cdn.com/v4/letter/k/47e85d/32.png) [@KlopgeestBE](https://discuss.elastic.co/u/KlopgeestBE)\
**Post date:** [December 12, 2016, 10:27am UTC](https://discuss.elastic.co/t/force-reroute-all-unassigned-shards/68596/5 "2016-12-12T10:27:59Z")

</div>

You can reallocate unassigned indexes as follows:

First query for unassigned indexes:  
`curl http://Elastic:92xx/_cat/indices?pretty`

Filter the unassigned shards.

Create a script which allocates unassigned shards to a data node:

```
curl -XPOST -d "{ ""commands"" : [{ ""allocate"" : {""index"" : """[IndexNumber]""", ""shard"" : [shardnumber], ""node"" : ""[data-nodename]"",""allow_primary"":true } } ] }" http://localhost:9203/_cluster/reroute?pretty
```

---

<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 9, 2017, 10:28am UTC](https://discuss.elastic.co/t/force-reroute-all-unassigned-shards/68596/6 "2017-01-09T10:28:11Z")

</div>

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