# Dfs\_query\_then\_fetch returns the same scores as query\_then\_fetch

**URL:** <https://discuss.elastic.co/t/dfs-query-then-fetch-returns-the-same-scores-as-query-then-fetch/273024>\
**Category:** Elasticsearch\
**Created:** [May 14, 2021, 1:33pm UTC](https://discuss.elastic.co/t/dfs-query-then-fetch-returns-the-same-scores-as-query-then-fetch/273024 "2021-05-14T13:33:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Drept](https://avatars.discourse-cdn.com/v4/letter/d/ce7236/32.png) [@Drept](https://discuss.elastic.co/u/Drept)\
**Post date:** [May 14, 2021, 1:33pm UTC](https://discuss.elastic.co/t/dfs-query-then-fetch-returns-the-same-scores-as-query-then-fetch/273024/1 "2021-05-14T13:33:58Z")

</div>

I have multiple indices in Elasticsearch (and the corresponding documents in Django created using django-elasticsearch-dsl). All of the indices have these settings:

```auto
    settings = {'number_of_shards': 1,
                'number_of_replicas': 0}

```

Now, I am trying to perform a search across all the 10 indices. In order to retrieve consistent scoring between the results from different indices, I am using **[dfs\_query\_then\_fetch](https://www.elastic.co/blog/understanding-query-then-fetch-vs-dfs-query-then-fetch)** :

```auto
search = Search(index=['mov*'])
search = search.params(search_type='dfs_query_then_fetch')
objects = search.query("multi_match", query='Tom & Jerry', fields=['title', 'actors'])

```

I get bad results due to inconsistent scoring. A book called ' _A story of Jerry and his friend Tom_ ' from one index can be ranked higher that the cartoon ' _Tom & Jerry_ ' from another index. The reason is that **dfs\_query\_then\_fetch** is not working. When I remove it or substitute with the simple **query\_then\_fetch** , I get absolutely the same results with the identical scoring.

I have tested it on URI requests as well, and I always get the same scores for both search types.

What can be the reason for it?

---

<div class="post-metadata">

**Author:** ![Drept](https://avatars.discourse-cdn.com/v4/letter/d/ce7236/32.png) [@Drept](https://discuss.elastic.co/u/Drept)\
**Post date:** [May 15, 2021, 2:57pm UTC](https://discuss.elastic.co/t/dfs-query-then-fetch-returns-the-same-scores-as-query-then-fetch/273024/2 "2021-05-15T14:57:02Z")

</div>

Some more data. Here is a sample query that is giving local scores despite **dfs\_query\_then\_fetch** :

localhost:9200/mov\*/\_search?search\_type=dfs\_query\_then\_fetch&q=Tom%20Jerry

I have tried including the preference parameter in the URL (just to test whether something changes). Using '\_primary' or '\_primary\_first' leads to _illegal\_argument\_exception_, otherwise the results returned are always the same – with local scores. I have absolutely no ideas why this happens.

---

<div class="post-metadata">

**Author:** ![Drept](https://avatars.discourse-cdn.com/v4/letter/d/ce7236/32.png) [@Drept](https://discuss.elastic.co/u/Drept)\
**Post date:** [May 25, 2021, 2:02pm UTC](https://discuss.elastic.co/t/dfs-query-then-fetch-returns-the-same-scores-as-query-then-fetch/273024/3 "2021-05-25T14:02:58Z")

</div>

**UPDATE:** The results are actually not the same, but they are only _really slightly different_ , e.g. a score of 50.1 with dfs and 50.0 without dfs, while the same model within one index has a score of 80.0.

Still desperate to get a clue.

---

<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:** [June 22, 2021, 2:03pm UTC](https://discuss.elastic.co/t/dfs-query-then-fetch-returns-the-same-scores-as-query-then-fetch/273024/4 "2021-06-22T14:03:42Z")

</div>

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