# How does elasticsearch route reads?

**URL:** <https://discuss.elastic.co/t/how-does-elasticsearch-route-reads/200700>\
**Category:** Elasticsearch\
**Created:** [September 23, 2019, 1:37pm UTC](https://discuss.elastic.co/t/how-does-elasticsearch-route-reads/200700 "2019-09-23T13:37:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Faiz\_Ahmed\_Mushtak\_H](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/faiz_ahmed_mushtak_h/32/47387_2.png) [@Faiz\_Ahmed\_Mushtak\_H](https://discuss.elastic.co/u/Faiz_Ahmed_Mushtak_H)\
**Post date:** [September 23, 2019, 1:37pm UTC](https://discuss.elastic.co/t/how-does-elasticsearch-route-reads/200700/1 "2019-09-23T13:37:56Z")

</div>

I have an index in which I am using auto expand replicas to 0-all. This means every node has every replica

So when a search request comes to ES, will it be processed by only one node? I am using 7.2 and the search request is specifically a percolator query. ES doc just says the requests are round-robin'd across the replicas. But given such a setup, it would benefit from executing on just one node right?

The index is mostly read-only

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [September 23, 2019, 3:51pm UTC](https://discuss.elastic.co/t/how-does-elasticsearch-route-reads/200700/2 "2019-09-23T15:51:11Z")

</div>

Elasticsearch will only search one copy of each shard, but if it is to search multiple shards then it will not necessarily choose copies that are all on the same node. This means the search can benefit from the resources of the whole cluster (CPU, IO bandwidth, filesystem cache etc).

Put differently, if you are searching a single index with `number_of_shards: 1` then there will be at most two nodes involved: the coordinating node and one of the data nodes holding a copy of that shard. These might or might not be the same node.

The [search profile API](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-profile.html) and its [UI](https://www.elastic.co/guide/en/kibana/current/xpack-profiler.html) are a good way to see the details of how a search was executed, including the nodes that were involved.

---

<div class="post-metadata">

**Author:** ![Faiz\_Ahmed\_Mushtak\_H](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/faiz_ahmed_mushtak_h/32/47387_2.png) [@Faiz\_Ahmed\_Mushtak\_H](https://discuss.elastic.co/u/Faiz_Ahmed_Mushtak_H)\
**Post date:** [September 23, 2019, 3:56pm UTC](https://discuss.elastic.co/t/how-does-elasticsearch-route-reads/200700/3 "2019-09-23T15:56:42Z")

</div>

oh alright, i'm sure you guys thought about the benefits. I asked because I went thru this post  
[https://www.elastic.co/blog/percolator](https://www.elastic.co/blog/percolator)

if you see the last section of it, it mentioned the benefit of auto\_expand\_replicas  
@DavidTurner

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [September 23, 2019, 4:09pm UTC](https://discuss.elastic.co/t/how-does-elasticsearch-route-reads/200700/4 "2019-09-23T16:09:30Z")

</div>

That blog post is pretty old and I don't think it reflects how things work today. See [the reference manual](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-percolate-query.html#how-it-works) for more up-to-date information.

---

<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:** [October 21, 2019, 4:09pm UTC](https://discuss.elastic.co/t/how-does-elasticsearch-route-reads/200700/5 "2019-10-21T16:09:40Z")

</div>

Closed on October 21, 2019, 4:09pm UTC

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