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?
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.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.