# Help to understand fuzzy score

**URL:** <https://discuss.elastic.co/t/help-to-understand-fuzzy-score/370870>\
**Category:** Elasticsearch\
**Created:** [November 21, 2024, 3:22am UTC](https://discuss.elastic.co/t/help-to-understand-fuzzy-score/370870 "2024-11-21T03:22:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yeikel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yeikel/32/125434_2.png) [@yeikel](https://discuss.elastic.co/u/yeikel)\
**Post date:** [November 21, 2024, 3:22am UTC](https://discuss.elastic.co/t/help-to-understand-fuzzy-score/370870/1 "2024-11-21T03:22:11Z")

</div>

Given the following search:

```auto
{
  "size": 100,
  "query": {
    "bool": {
      "must": [
        {
          "match": {
            "business_names": {
              "query": "my company",
              "operator": "and",
              "fuzziness": "auto"
            }
          }
        }
      ]
    }
  }
}

```

I see results like `MY LITTLE COMPANY` with a higher score than documents that match the input exactly.

How can I formulate the query so that results that match the input exactly are at the top of the results?

One Idea is to create another query that matches exactly with a boost, but why that is needed?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [November 21, 2024, 7:43am UTC](https://discuss.elastic.co/t/help-to-understand-fuzzy-score/370870/2 "2024-11-21T07:43:36Z")

</div>

You can create a bool query with 2 should clauses. One with a fuzzy search. Another one without.

As the second will match when texts are identical, the score will be higher.

An example of this here:

> <https://gist.github.com/dadoonet/5179ee72ecbf08f12f53d4bda1b76bab>

---

<div class="post-metadata">

**Author:** ![yeikel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yeikel/32/125434_2.png) [@yeikel](https://discuss.elastic.co/u/yeikel)\
**Post date:** [November 21, 2024, 12:33pm UTC](https://discuss.elastic.co/t/help-to-understand-fuzzy-score/370870/3 "2024-11-21T12:33:34Z")

</div>

Thanks, that's what I hinted above

I am still trying to understand why the fuzzy result is scored higher

Is this due to the relevance of the tokens relatively to the index?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [November 21, 2024, 12:57pm UTC](https://discuss.elastic.co/t/help-to-understand-fuzzy-score/370870/4 "2024-11-21T12:57:23Z")

</div>

> [@yeikel](#):
>
> I am still trying to understand why the fuzzy result is scored higher

Note that it could depend on the size of the field, on the total number of terms in the index, on the number of shards... So many factors.

You can try to understand using `"explain": true`.
