Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is elasticsearch non-deterministic?

Does elasticsearch does not return the same results in the same order every time a query is executed because of its algorithm in calculating the score? Or is it something else? Is there a way to make it such that the results return in the same order everytime a query is executed? Is this normal?

like image 593
Setsuna Avatar asked Aug 06 '13 22:08

Setsuna


1 Answers

This might to do with the way elastic search calculates relevancy scores locally by default.

Try adding:

&search_type=dfs_query_then_fetch

to your query and see if that helps. This tells ES to calculate scores across the whole cluster.

More info:

http://www.elastic.co/blog/understanding-query-then-fetch-vs-dfs-query-then-fetch/

like image 188
Constantijn Visinescu Avatar answered Nov 06 '22 01:11

Constantijn Visinescu