# Route indexing requests to a specific node instead of a shard

**URL:** <https://discuss.elastic.co/t/route-indexing-requests-to-a-specific-node-instead-of-a-shard/277939>\
**Category:** Elasticsearch\
**Created:** [July 6, 2021, 9:11am UTC](https://discuss.elastic.co/t/route-indexing-requests-to-a-specific-node-instead-of-a-shard/277939 "2021-07-06T09:11:20Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joel4](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joel4/32/91223_2.png) [@Joel4](https://discuss.elastic.co/u/Joel4)\
**Post date:** [July 6, 2021, 9:11am UTC](https://discuss.elastic.co/t/route-indexing-requests-to-a-specific-node-instead-of-a-shard/277939/1 "2021-07-06T09:11:20Z")

</div>

Hi, I searched through the docs but I could not find a way to route index requests to a **specific node** , instead of a specific shard.

If routing to a specific node is not possible, then is it possible to create shard-node mappings as index templates?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [July 6, 2021, 9:18am UTC](https://discuss.elastic.co/t/route-indexing-requests-to-a-specific-node-instead-of-a-shard/277939/2 "2021-07-06T09:18:20Z")

</div>

Indexing is always first done on the primary shard and then replicated. Elasticsearch can move primary shards around in response to cluster events so it is not possible to tie it to specific nodes.

---

<div class="post-metadata">

**Author:** ![Joel4](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joel4/32/91223_2.png) [@Joel4](https://discuss.elastic.co/u/Joel4)\
**Post date:** [July 6, 2021, 9:29am UTC](https://discuss.elastic.co/t/route-indexing-requests-to-a-specific-node-instead-of-a-shard/277939/3 "2021-07-06T09:29:40Z")

</div>

Consider I have disabled cluster rebalancing and shard replication.

So, can I specify a node-shard mapping for an index (preferably using templates) ?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [July 6, 2021, 9:33am UTC](https://discuss.elastic.co/t/route-indexing-requests-to-a-specific-node-instead-of-a-shard/277939/4 "2021-07-06T09:33:44Z")

</div>

> [@Joel4](#):
>
> Consider I have disabled cluster rebalancing and shard replication.

Usually one of the main reasons to have multiple nodes in a cluster is to achieve high availability. Not having any replicas and diabling cluster rebalancing would remove that, which sounds risky.

What is the problem you are trying to solve? Do you need your data to be resilient and available?

---

<div class="post-metadata">

**Author:** ![Joel4](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joel4/32/91223_2.png) [@Joel4](https://discuss.elastic.co/u/Joel4)\
**Post date:** [July 6, 2021, 9:40am UTC](https://discuss.elastic.co/t/route-indexing-requests-to-a-specific-node-instead-of-a-shard/277939/5 "2021-07-06T09:40:42Z")

</div>

I can accept data loss, but I am trying to reduce index request routing traffic between nodes.

What I need is:

node -1 \<- receives bulk requests from multiple log forwarders.  
node -2 \<- receives bulk requests from multiple log forwarders.

Now I prefer the request received to be processed/written to the same node (shard in the node), instead of being routed to other shard.

This is my case.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [July 6, 2021, 9:43am UTC](https://discuss.elastic.co/t/route-indexing-requests-to-a-specific-node-instead-of-a-shard/277939/6 "2021-07-06T09:43:41Z")

</div>

What is the rationale behind this requirement? Are the nodes far apart?

If you do not care about availability and resiliency you could set up two separate single node clusters and query using cross cluster search.

---

<div class="post-metadata">

**Author:** ![Joel4](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joel4/32/91223_2.png) [@Joel4](https://discuss.elastic.co/u/Joel4)\
**Post date:** [July 6, 2021, 9:57am UTC](https://discuss.elastic.co/t/route-indexing-requests-to-a-specific-node-instead-of-a-shard/277939/7 "2021-07-06T09:57:03Z")

</div>

> [@Christian\_Dahlqvist](#):
>
> What is the rationale behind this requirement? Are the nodes far apart?

They perform high network intensive tasks.

> [@Christian\_Dahlqvist](#):
>
> If you do not care about availability and resiliency you could set up two separate single node clusters and query using cross cluster search.

Yes @Christian_Dahlqvist , but I don't want the search query to be updated based on the number of clusters (/nodes) added.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [July 6, 2021, 12:33pm UTC](https://discuss.elastic.co/t/route-indexing-requests-to-a-specific-node-instead-of-a-shard/277939/8 "2021-07-06T12:33:50Z")

</div>

What you are trying to do goes against how Elasticsearch was designed to work, so I would not recommend going down this route. It might be possible through shard allocation filtering but would as far as I can tell give you a cluster that is not very resilient nor highly available.

Why is the network traffic between the nodes such aproblem for you?

---

<div class="post-metadata">

**Author:** ![Joel4](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joel4/32/91223_2.png) [@Joel4](https://discuss.elastic.co/u/Joel4)\
**Post date:** [July 6, 2021, 1:09pm UTC](https://discuss.elastic.co/t/route-indexing-requests-to-a-specific-node-instead-of-a-shard/277939/9 "2021-07-06T13:09:00Z")

</div>

@Christian_Dahlqvist Thanks for your help, I guess I'll go along with the cross cluster approach.

---

<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:** [August 3, 2021, 1:09pm UTC](https://discuss.elastic.co/t/route-indexing-requests-to-a-specific-node-instead-of-a-shard/277939/10 "2021-08-03T13:09:09Z")

</div>

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