Scores not consistent between environments


(Steve) #1

I have a very simple person name search that is returning different scores in different environments. Let's say my search in both environments is for Lori Jefferies. In my test environment, this scores the results as I am expecting and of the three users I have: Lori Jefferies, Lori Packer, and Lori Polca, jefferies is scored highest because of the two fields matching.

In my production environment, however, all users score exactly the same, even though Lori Jefferies matches both fields. This gist shows the results with explanation in both environments.

There are probably about 40 matching users total in production, but I don't understand why Lori Jefferies is not scored as the highest, and ranked as such since even in the production explanation it shows both the first_name and last_name match.

My query is a pretty simple {"multi_match":{"query":"lori jefferies","fields":["email","first_name","last_name","phone"]}}

Any help would be appreciated.

Thanks,
Steve


(Ivan Brusic) #2

It appears that your two environments differ greatly on the number of
documents contained. Is your environment sharded? All your hits come from
the same shard, so I am assuming it is not. Production has over a million
documents, while test only six (in the shard containing the hits).

Because of the increased volume on production, the idf for the last_name
field is not scored as highly as on development. Since the default behavior
of multi_match is best_field, it will execute a dismax query underneath,
always favoring the first name.

For more consistent behavior, try to index more content on development to
further influence the IDF. Try playing around with the multi_match
settings, perhaps opting for cross_fields.

Cheers,

Ivan


(system) #3