Dfs_query_then_fetch returns the same scores as query_then_fetch

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

    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 :

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?

Some more data. Here is a sample query that is giving local scores despite dfs_query_then_fetch:


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.

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.

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