# Is dfs\_query\_then\_fetch relevant for BM25/ES 5.0?

**URL:** <https://discuss.elastic.co/t/is-dfs-query-then-fetch-relevant-for-bm25-es-5-0/63210>\
**Category:** Elasticsearch\
**Created:** [October 17, 2016, 5:48pm UTC](https://discuss.elastic.co/t/is-dfs-query-then-fetch-relevant-for-bm25-es-5-0/63210 "2016-10-17T17:48:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![drs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/drs/32/8001_2.png) [@drs](https://discuss.elastic.co/u/drs)\
**Post date:** [October 17, 2016, 5:48pm UTC](https://discuss.elastic.co/t/is-dfs-query-then-fetch-relevant-for-bm25-es-5-0/63210/1 "2016-10-17T17:48:12Z")

</div>

I'm interested in getting accurate scores for queries that span multiple indices with distinct document types. I understand today I can use `dfs_query_then_fetch` to ensure the document frequencies are relevant to the whole corpus of documents, not just each shard.

How is this affected with the switch to BM25? Would `dfs_query_then_fetch` solve the same problem on queries across indices scored by BM25? Are there other terms of the calculation that need pre-querying in BM25 like document frequency needs in TF-IDF?

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [October 17, 2016, 7:09pm UTC](https://discuss.elastic.co/t/is-dfs-query-then-fetch-relevant-for-bm25-es-5-0/63210/2 "2016-10-17T19:09:12Z")

</div>

Even with dfs\_query\_then\_fetch, the values are still only calculate per  
index, so it will not solve your problem for a multi-index search.

In the single index case, I think dfs\_query\_then\_fetch is still beneficial.  
BM25 will saturate the TF values sooner, but the value would still be  
calculated per shard without it. Usually it just takes large indices to  
have better sharded TF values.

The Lucene BM25 parameters deal with term frequencies, not document  
frequencies.

Ivan

---

<div class="post-metadata">

**Author:** ![drs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/drs/32/8001_2.png) [@drs](https://discuss.elastic.co/u/drs)\
**Post date:** [October 20, 2016, 5:00pm UTC](https://discuss.elastic.co/t/is-dfs-query-then-fetch-relevant-for-bm25-es-5-0/63210/3 "2016-10-20T17:00:42Z")

</div>

Thanks for the explanation, that's quite helpful.

---

<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:** [July 5, 2017, 10:10pm UTC](https://discuss.elastic.co/t/is-dfs-query-then-fetch-relevant-for-bm25-es-5-0/63210/4 "2017-07-05T22:10:45Z")

</div>


