# Are queries routed to the primary OR a replica, or the primary AND all replicas?

**URL:** <https://discuss.elastic.co/t/are-queries-routed-to-the-primary-or-a-replica-or-the-primary-and-all-replicas/150073>\
**Category:** Elasticsearch\
**Created:** [September 26, 2018, 7:08pm UTC](https://discuss.elastic.co/t/are-queries-routed-to-the-primary-or-a-replica-or-the-primary-and-all-replicas/150073 "2018-09-26T19:08:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrew\_rueckert](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrew_rueckert/32/31974_2.png) [@andrew\_rueckert](https://discuss.elastic.co/u/andrew_rueckert)\
**Post date:** [September 26, 2018, 7:08pm UTC](https://discuss.elastic.co/t/are-queries-routed-to-the-primary-or-a-replica-or-the-primary-and-all-replicas/150073/1 "2018-09-26T19:08:35Z")

</div>

I have an index that is 1 shard with 2 replicas, and only 3 nodes in the cluster. If I make a query against this index, is it randomly routed to 1 node in the cluster, or is it routed to all nodes in the cluster (and a response accepted from whichever shard responds first)?

If I have a low-data, write-light, and query-heavy workload (like percolation), am I better served by having more nodes, and a replica on each? Or does adding another node with another copy of the data just mean that I have 4 nodes running every query instead of 3?

---

<div class="post-metadata">

**Author:** ![loren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/loren/32/44942_2.png) [@loren](https://discuss.elastic.co/u/loren)\
**Post date:** [September 27, 2018, 10:39pm UTC](https://discuss.elastic.co/t/are-queries-routed-to-the-primary-or-a-replica-or-the-primary-and-all-replicas/150073/2 "2018-09-27T22:39:14Z")

</div>

The query is routed to one shard copy (primary or a replica).

Which copy gets chosen depends on what version you are running, and whether you have indicated any shard preferences.

The default is round-robin, but the [docs for 6.4](https://www.elastic.co/guide/en/elasticsearch/reference/6.4/tune-for-search-speed.html#_use_literal_preference_literal_to_optimize_cache_utilization) still suggest using `preference` to tune for search speed, although [that is going away in 7.0](https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-7.0.html#_shard_preferences_literal __primary_literal_literal__ primary_first_literal_literal __replica_literal_and_literal__ replica_first_literal_are_removed). You have [adaptive replica selection](https://www.elastic.co/guide/en/elasticsearch/reference/6.4/search.html#search-adaptive-replica) as an option, too.

I'd suggest benchmarking to see which approach works best for your use case.

---

<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 25, 2018, 10:39pm UTC](https://discuss.elastic.co/t/are-queries-routed-to-the-primary-or-a-replica-or-the-primary-and-all-replicas/150073/3 "2018-10-25T22:39:14Z")

</div>

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