# How to allocate node to index shards

**URL:** <https://discuss.elastic.co/t/how-to-allocate-node-to-index-shards/213330>\
**Category:** Elasticsearch\
**Created:** [December 30, 2019, 10:57am UTC](https://discuss.elastic.co/t/how-to-allocate-node-to-index-shards/213330 "2019-12-30T10:57:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![adityaPsl](https://avatars.discourse-cdn.com/v4/letter/a/e47c2d/32.png) [@adityaPsl](https://discuss.elastic.co/u/adityaPsl)\
**Post date:** [December 30, 2019, 10:57am UTC](https://discuss.elastic.co/t/how-to-allocate-node-to-index-shards/213330/1 "2019-12-30T10:57:32Z")

</div>

Hello Team,

Can we allocate particular node and to an index so all the shards created for that index would get created to the defined node.  
I read about reroute API but could not find allocation option. can we define this in index setting.  
Is there different option available to handle this if index exist and index does not exist.

Thank you,  
Aditya

---

<div class="post-metadata">

**Author:** ![Armin\_Braun](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/armin_braun/32/20092_2.png) [@Armin\_Braun](https://discuss.elastic.co/u/Armin_Braun)\
**Post date:** [December 30, 2019, 12:51pm UTC](https://discuss.elastic.co/t/how-to-allocate-node-to-index-shards/213330/2 "2019-12-30T12:51:47Z")

</div>

Hi @adityaPsl

you could use index shard allocation here. See the documentation for it [here](https://www.elastic.co/guide/en/elasticsearch/reference/7.5/shard-allocation-filtering.html#index-allocation-settings).

`index.routing.allocation.include. _name` set to the node's name you want to force the index onto should do the trick in your case.

---

<div class="post-metadata">

**Author:** ![adityaPsl](https://avatars.discourse-cdn.com/v4/letter/a/e47c2d/32.png) [@adityaPsl](https://discuss.elastic.co/u/adityaPsl)\
**Post date:** [December 30, 2019, 1:38pm UTC](https://discuss.elastic.co/t/how-to-allocate-node-to-index-shards/213330/3 "2019-12-30T13:38:25Z")

</div>

Hello Armin\_Braun,  
Thank you for your reply. I think this will work when index is not available or before creating the index. But if index is already created then do we have to use reroute api to move the existing data to the specific node? along with this setting?

Thank you,  
Aditya

---

<div class="post-metadata">

**Author:** ![Armin\_Braun](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/armin_braun/32/20092_2.png) [@Armin\_Braun](https://discuss.elastic.co/u/Armin_Braun)\
**Post date:** [December 30, 2019, 1:42pm UTC](https://discuss.elastic.co/t/how-to-allocate-node-to-index-shards/213330/4 "2019-12-30T13:42:15Z")

</div>

No problem @adityaPsl

I think just updating the setting on an existing index should be enough. Unless the setting conflicts with any other routing constraints in your cluster it should be applied and result in shard relocations without a manual reroute.

---

<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, 2020, 1:42pm UTC](https://discuss.elastic.co/t/how-to-allocate-node-to-index-shards/213330/5 "2020-01-27T13:42:21Z")

</div>

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