# "dfs\_query\_then\_fetch" and "query\_then\_fetch" return the same score

**URL:** <https://discuss.elastic.co/t/dfs-query-then-fetch-and-query-then-fetch-return-the-same-score/115623>\
**Category:** Elasticsearch\
**Created:** [January 16, 2018, 3:00am UTC](https://discuss.elastic.co/t/dfs-query-then-fetch-and-query-then-fetch-return-the-same-score/115623 "2018-01-16T03:00:14Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![hubo3085632](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hubo3085632/32/23724_2.png) [@hubo3085632](https://discuss.elastic.co/u/hubo3085632)\
**Post date:** [January 16, 2018, 3:00am UTC](https://discuss.elastic.co/t/dfs-query-then-fetch-and-query-then-fetch-return-the-same-score/115623/1 "2018-01-16T03:00:14Z")

</div>

i known the difference between "dfs\_query\_then\_fetch" and "query\_then\_fetch",I think this will return different idf ,but it return the same idf and same score,why is it？

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 16, 2018, 4:13am UTC](https://discuss.elastic.co/t/dfs-query-then-fetch-and-query-then-fetch-return-the-same-score/115623/2 "2018-01-16T04:13:50Z")

</div>

I guess it can happen:

- with 1 shard for the day index
- when hitting 1 shard (routing)
- with "luck"
- on a sample index with only one document

Anyway, may be paste your queries and the result?  
`explain` option might tell you as well.

---

<div class="post-metadata">

**Author:** ![hubo3085632](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hubo3085632/32/23724_2.png) [@hubo3085632](https://discuss.elastic.co/u/hubo3085632)\
**Post date:** [January 16, 2018, 7:49am UTC](https://discuss.elastic.co/t/dfs-query-then-fetch-and-query-then-fetch-return-the-same-score/115623/3 "2018-01-16T07:49:56Z")

</div>

thanks a lot ,i find all docs which has the term is on the same shard

---

<div class="post-metadata">

**Author:** ![hubo3085632](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hubo3085632/32/23724_2.png) [@hubo3085632](https://discuss.elastic.co/u/hubo3085632)\
**Post date:** [January 16, 2018, 2:02pm UTC](https://discuss.elastic.co/t/dfs-query-then-fetch-and-query-then-fetch-return-the-same-score/115623/4 "2018-01-16T14:02:04Z")

</div>

but why does "maxDocs" in explain is same? i used different search type, there are 4 shards total 1246 docs,when search with query\_then\_fetch the "maxDocs" is 465,but search with dfs\_query\_then\_fetch the "maxDocs" is also 465, why not is 1246?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 16, 2018, 2:22pm UTC](https://discuss.elastic.co/t/dfs-query-then-fetch-and-query-then-fetch-return-the-same-score/115623/5 "2018-01-16T14:22:57Z")

</div>

I don't know with a complete example but what is actually the problem you want to solve?

---

<div class="post-metadata">

**Author:** ![hubo3085632](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hubo3085632/32/23724_2.png) [@hubo3085632](https://discuss.elastic.co/u/hubo3085632)\
**Post date:** [January 16, 2018, 2:46pm UTC](https://discuss.elastic.co/t/dfs-query-then-fetch-and-query-then-fetch-return-the-same-score/115623/6 "2018-01-16T14:46:48Z")

</div>

I am preparing data for training Elasticsearch to my colleague, i need present the similarity algorithms,so i need a case to introducing TF/IDF ,when i use this "idf(t) = 1 + log ( numDocs / (docFreq + 1))" function i was confused about "numDocs" and "maxDocs"

---

<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:** [February 13, 2018, 2:46pm UTC](https://discuss.elastic.co/t/dfs-query-then-fetch-and-query-then-fetch-return-the-same-score/115623/7 "2018-02-13T14:46:49Z")

</div>

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