# Is there any way to avoid using dfs\_query\_then\_fetch ?

**URL:** <https://discuss.elastic.co/t/is-there-any-way-to-avoid-using-dfs-query-then-fetch/347540>\
**Category:** Elasticsearch\
**Created:** [November 20, 2023, 2:42pm UTC](https://discuss.elastic.co/t/is-there-any-way-to-avoid-using-dfs-query-then-fetch/347540 "2023-11-20T14:42:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arnaud\_Schneider](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/arnaud_schneider/32/127765_2.png) [@Arnaud\_Schneider](https://discuss.elastic.co/u/Arnaud_Schneider)\
**Post date:** [November 20, 2023, 2:42pm UTC](https://discuss.elastic.co/t/is-there-any-way-to-avoid-using-dfs-query-then-fetch/347540/1 "2023-11-20T14:42:33Z")

</div>

Hello,

i have an Elastic query using score to sort results by relevancy.

Me, and others devs, have observed that, on one particular request, the order of the results is inconsistent, because the differents documents are on differents shards.  
Thanks to [this thread](https://discuss.elastic.co/t/inconsistent-search-scoring-between-shards/163686/5), I quickly find [this page](https://www.elastic.co/fr/blog/understanding-query-then-fetch-vs-dfs-query-then-fetch), and understood the problem : document's score are messed up during the query, because those documents are on differents shards. Using the search type dfs\_query\_then\_fetch could be a workaround.

But my boss is afraid of the performance impact this parameter could cause. So he would rather not to.  
According to him, we cannot have only one shards.  
Also according to him, we cannot manually balance shards, because Elastic does it by it self.  
We will try the parameter search\_type=dfs\_query\_then\_fetch for some performance test.

But ultimately, if the performance became very bad, is there any way to approach inconsistent scoring between shards ?

Thanks in advance.

---

<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:** [December 18, 2023, 2:43pm UTC](https://discuss.elastic.co/t/is-there-any-way-to-avoid-using-dfs-query-then-fetch/347540/2 "2023-12-18T14:43:08Z")

</div>

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