# Elasticsearch Trace Route

**URL:** <https://discuss.elastic.co/t/elasticsearch-trace-route/228784>\
**Category:** Elasticsearch\
**Created:** [April 20, 2020, 4:53am UTC](https://discuss.elastic.co/t/elasticsearch-trace-route/228784 "2020-04-20T04:53:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alsheh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alsheh/32/36799_2.png) [@Alsheh](https://discuss.elastic.co/u/Alsheh)\
**Post date:** [April 20, 2020, 4:53am UTC](https://discuss.elastic.co/t/elasticsearch-trace-route/228784/1 "2020-04-20T04:53:28Z")

</div>

Is there a way to trace the route of search & indexing requests to nodes within the cluster? I have lots of dedicated nodes in the cluster and I want to confirm requests routing is optimized by checking the path the requests take to the targeted shards.

Thanks!

---

<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:** [April 20, 2020, 6:24am UTC](https://discuss.elastic.co/t/elasticsearch-trace-route/228784/2 "2020-04-20T06:24:40Z")

</div>

A request will usually take no more than 2 nodes to get to the data, no matter where you ask it. Either the node that receives the data has it, so it sends the response back directly, or it sends it to another node it knows has the data and waits for the response.

This would change if the node that requests the data has just left the cluster, and the cluster state hasn't updated, so it'll need to try another node, but that's not likely to be a common thing.

What sort of things are you looking to optimise though?

---

<div class="post-metadata">

**Author:** ![Alsheh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alsheh/32/36799_2.png) [@Alsheh](https://discuss.elastic.co/u/Alsheh)\
**Post date:** [April 20, 2020, 7:33am UTC](https://discuss.elastic.co/t/elasticsearch-trace-route/228784/3 "2020-04-20T07:33:49Z")

</div>

This is helpful.. thanks @warkolm! Does this routing method apply to indexing requests as well?

> What sort of things are you looking to optimise though?

Sometimes, I see high search latency with some expensive queries and high indexing time and I just needed to confirm that the shortest path will always be taken such that search requests from client nodes don't get sent to warm or ML nodes when data resides on hot data nodes.

---

<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:** [April 20, 2020, 7:37am UTC](https://discuss.elastic.co/t/elasticsearch-trace-route/228784/4 "2020-04-20T07:37:08Z")

</div>

The major difference between a querying and indexing is the query can go to a primary or secondary shard. Indexing will always go to the primary.

> [@Alsheh](#):
>
> such that search requests from client nodes don't get sent to warm or ML nodes when data resides on hot data nodes

Unless your query is being sent to these nodes as the first step in the process - that is, your client is selecting these nodes to talk to - then it's unlikely.

---

<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:** [May 18, 2020, 7:48am UTC](https://discuss.elastic.co/t/elasticsearch-trace-route/228784/5 "2020-05-18T07:48:38Z")

</div>

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