# Exact matches have same score as fuzzy matches

**URL:** <https://discuss.elastic.co/t/exact-matches-have-same-score-as-fuzzy-matches/211451>\
**Category:** Elasticsearch\
**Created:** [December 11, 2019, 10:50am UTC](https://discuss.elastic.co/t/exact-matches-have-same-score-as-fuzzy-matches/211451 "2019-12-11T10:50:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![duncRed](https://avatars.discourse-cdn.com/v4/letter/d/9d8465/32.png) [@duncRed](https://discuss.elastic.co/u/duncRed)\
**Post date:** [December 11, 2019, 10:50am UTC](https://discuss.elastic.co/t/exact-matches-have-same-score-as-fuzzy-matches/211451/1 "2019-12-11T10:50:50Z")

</div>

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](https://discuss.elastic.co/t/custom-score-for-fuzzy-matching-based-on-levenshtein-distance-score/125544/2) and here [Fuzziness & score computation](https://discuss.elastic.co/t/fuzziness-score-computation/16492).

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

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [December 11, 2019, 10:55am UTC](https://discuss.elastic.co/t/exact-matches-have-same-score-as-fuzzy-matches/211451/2 "2019-12-11T10:55:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [December 11, 2019, 11:10am UTC](https://discuss.elastic.co/t/exact-matches-have-same-score-as-fuzzy-matches/211451/3 "2019-12-11T11:10:01Z")

</div>

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](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-multi-term-rewrite.html) setting.

> [@duncRed](#):
>
> I have come across suggested solutions to promote exact matches by including additional queries which carry out an exact match

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.

---

<div class="post-metadata">

**Author:** ![duncRed](https://avatars.discourse-cdn.com/v4/letter/d/9d8465/32.png) [@duncRed](https://discuss.elastic.co/u/duncRed)\
**Post date:** [December 13, 2019, 9:50am UTC](https://discuss.elastic.co/t/exact-matches-have-same-score-as-fuzzy-matches/211451/4 "2019-12-13T09:50:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 10, 2020, 9:50am UTC](https://discuss.elastic.co/t/exact-matches-have-same-score-as-fuzzy-matches/211451/5 "2020-01-10T09:50:20Z")

</div>

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