# Question about some details for Query Phase

**URL:** <https://discuss.elastic.co/t/question-about-some-details-for-query-phase/227232>\
**Category:** Elasticsearch\
**Created:** [April 9, 2020, 5:09am UTC](https://discuss.elastic.co/t/question-about-some-details-for-query-phase/227232 "2020-04-09T05:09:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hyunsoo\_Shim](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hyunsoo_shim/32/55197_2.png) [@Hyunsoo\_Shim](https://discuss.elastic.co/u/Hyunsoo_Shim)\
**Post date:** [April 9, 2020, 5:09am UTC](https://discuss.elastic.co/t/question-about-some-details-for-query-phase/227232/1 "2020-04-09T05:09:49Z")

</div>

Dear All,

Could you let me know how to process "Query Phase" exactly when an index has replicas?  
For all I know, The coordinating node sends Query to every shard for Query Phase.  
I want to understand the exact meaning of **every shard** for Query phase.

For example, an Index of 2 shards(P0, P1) and 1 replica(R0, R1) is allocated in 4 Nodes like below.

- Node\_A : P1
- Node\_B : R0
- Node\_C : R1
- Node\_D : P0

Let's suppose that Node\_C receives a search request(i.e., Node\_C is the coordinating node now).

Q1 : Does Node\_C send Query request to all shards(P1, R0, R1, P0) or to just 2 shards(e.g., "P1 and R0" or "R1 and P0")?  
If the latter, how does ES decide 2 shards to send Query request?

Q2 : If the query type is DFS\_Query\_then\_Fetch, are the target shards for Pre-Query also same with the shards for Query?

Thanks for your help always.

---

<div class="post-metadata">

**Author:** ![oneoneonepig](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/oneoneonepig/32/66018_2.png) [@oneoneonepig](https://discuss.elastic.co/u/oneoneonepig)\
**Post date:** [April 9, 2020, 5:24am UTC](https://discuss.elastic.co/t/question-about-some-details-for-query-phase/227232/2 "2020-04-09T05:24:24Z")

</div>

For Q1, the search uses "[adaptive replica selection](https://www.elastic.co/guide/en/elasticsearch/reference/current/search.html#search-adaptive-replica)" by default, which sends the query to the "best" shards

---

<div class="post-metadata">

**Author:** ![Hyunsoo\_Shim](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hyunsoo_shim/32/55197_2.png) [@Hyunsoo\_Shim](https://discuss.elastic.co/u/Hyunsoo_Shim)\
**Post date:** [April 9, 2020, 5:41am UTC](https://discuss.elastic.co/t/question-about-some-details-for-query-phase/227232/3 "2020-04-09T05:41:38Z")

</div>

Thanks for your reply.  
Do you mean that the coordinating node sends Query to only 2 shards in case of my example?  
(2 shards is selected by "adaptive replica selection")

---

<div class="post-metadata">

**Author:** ![oneoneonepig](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/oneoneonepig/32/66018_2.png) [@oneoneonepig](https://discuss.elastic.co/u/oneoneonepig)\
**Post date:** [April 9, 2020, 5:46am UTC](https://discuss.elastic.co/t/question-about-some-details-for-query-phase/227232/4 "2020-04-09T05:46:25Z")

</div>

For what I understand, yes

---

<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 7, 2020, 5:46am UTC](https://discuss.elastic.co/t/question-about-some-details-for-query-phase/227232/5 "2020-05-07T05:46:29Z")

</div>

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