Exact matches have same score as fuzzy matches

Hi

When executing match queries with fuzziness applied we are seeing exact matches have the same score as fuzzy matches. I have come across suggested solutions to promote exact matches by including additional queries which carry out an exact match and boosting those queries, these are here Custom score for fuzzy matching based on Levenshtein distance score and here Fuzziness & score computation.

We are currently using Elasticsearch 7.4, is this still the recommended solution or has anything further been introduced to Elasticsearch which would help with this issue?

Many Thanks

Can you share your query? How many shards do you have?

Digging a little deeper there are some complexities here.
Auto-expanded queries like fuzzy can produce a lot of search term variations. For performance reasons the engine can choose not to score all of these variants by rewriting the search to a "constant score" query (all variants score the same). You can control this behaviour with the rewrite setting.

For now this is not a bad approach. In future we are looking into ways to make all auto-expanded queries prefer matches on the input term while keeping performance costs down on matching all of the variants.

Thanks Mark. Just to update this we are going down the route of including an exact match condition with a boost so exact matches are promoted.

1 Like

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