# How to allocate all the unassigned shards at a time?

**URL:** <https://discuss.elastic.co/t/how-to-allocate-all-the-unassigned-shards-at-a-time/66218>\
**Category:** Elasticsearch\
**Created:** [November 16, 2016, 8:29am UTC](https://discuss.elastic.co/t/how-to-allocate-all-the-unassigned-shards-at-a-time/66218 "2016-11-16T08:29:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hariyecharla](https://avatars.discourse-cdn.com/v4/letter/h/d26b3c/32.png) [@hariyecharla](https://discuss.elastic.co/u/hariyecharla)\
**Post date:** [November 16, 2016, 8:29am UTC](https://discuss.elastic.co/t/how-to-allocate-all-the-unassigned-shards-at-a-time/66218/1 "2016-11-16T08:29:33Z")

</div>

for shard in $(curl -XGET [http://localhost:9200/\_cat/shards](http://localhost:9200/_cat/shards) | grep UNASSIGNED | awk '{print $2}'); do  
curl -XPOST 'localhost:9200/\_cluster/reroute' -d '{  
"commands" : [ {  
"allocate" : {  
"index" : "test",  
"shard" : 0,  
"node" : "node name",  
"allow\_primary" : true  
}  
}  
]  
}'  
sleep 5  
done

In this we can allocate one by shards belongs to particular index to a node But how can we allocate all the shards at a time

---

<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:** [December 14, 2016, 8:29am UTC](https://discuss.elastic.co/t/how-to-allocate-all-the-unassigned-shards-at-a-time/66218/2 "2016-12-14T08:29:38Z")

</div>

Closed on December 14, 2016, 8:29am UTC

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