# When Search goes to Replica shard?

**URL:** <https://discuss.elastic.co/t/when-search-goes-to-replica-shard/338021>\
**Category:** Elasticsearch\
**Created:** [July 10, 2023, 11:45am UTC](https://discuss.elastic.co/t/when-search-goes-to-replica-shard/338021 "2023-07-10T11:45:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![siddhartha\_c](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/siddhartha_c/32/115957_2.png) [@siddhartha\_c](https://discuss.elastic.co/u/siddhartha_c)\
**Post date:** [July 10, 2023, 11:45am UTC](https://discuss.elastic.co/t/when-search-goes-to-replica-shard/338021/1 "2023-07-10T11:45:35Z")

</div>

I have a scenario , wherein I would need to perform searches in Elastic , but the number of "concurrent searches" are very less. In this case , can I assume that the searches will go to Primary shards?  
My understanding is that , whenever a search is fired, the search will go to Primary shards in general ; it will go to Replica shard only if the Primary shard is busy .  
Please let me know if the understanding is correct ?  
When does a search goes to Replica shard?

---

<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 10, 2023, 11:55am UTC](https://discuss.elastic.co/t/when-search-goes-to-replica-shard/338021/2 "2023-07-10T11:55:16Z")

</div>

> [@siddhartha\_c](#):
>
> My understanding is that , whenever a search is fired, the search will go to Primary shards in general ; it will go to Replica shard only if the Primary shard is busy .

Searches will in general round-robin between primary and replica shards irrespective how busy the cluster is.

---

<div class="post-metadata">

**Author:** ![siddhartha\_c](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/siddhartha_c/32/115957_2.png) [@siddhartha\_c](https://discuss.elastic.co/u/siddhartha_c)\
**Post date:** [July 10, 2023, 2:30pm UTC](https://discuss.elastic.co/t/when-search-goes-to-replica-shard/338021/3 "2023-07-10T14:30:07Z")

</div>

Can we configure the search to go to only primary shards ? and go to replica only when primary is busy/not available ?

---

<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 10, 2023, 2:40pm UTC](https://discuss.elastic.co/t/when-search-goes-to-replica-shard/338021/4 "2023-07-10T14:40:38Z")

</div>

You can do that by [setting preference at the query level](https://www.elastic.co/guide/en/elasticsearch/reference/8.8/search-shard-routing.html#shard-and-node-preference). Why would you look to do this? It can cause load imbalance in the cluster.

---

<div class="post-metadata">

**Author:** ![siddhartha\_c](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/siddhartha_c/32/115957_2.png) [@siddhartha\_c](https://discuss.elastic.co/u/siddhartha_c)\
**Post date:** [July 10, 2023, 2:52pm UTC](https://discuss.elastic.co/t/when-search-goes-to-replica-shard/338021/5 "2023-07-10T14:52:01Z")

</div>

We have a cluster which is across 2 data centers and we want most of the searches to go to primary data centers as most of the searches are triggered from Application deployed in Primary data center.

---

<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 7, 2023, 2:52pm UTC](https://discuss.elastic.co/t/when-search-goes-to-replica-shard/338021/6 "2023-08-07T14:52:40Z")

</div>

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