# What is boost in similarity score function?

**URL:** <https://discuss.elastic.co/t/what-is-boost-in-similarity-score-function/318091>\
**Category:** Elasticsearch\
**Created:** [November 3, 2022, 10:08am UTC](https://discuss.elastic.co/t/what-is-boost-in-similarity-score-function/318091 "2022-11-03T10:08:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fsanzestevez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fsanzestevez/32/112675_2.png) [@fsanzestevez](https://discuss.elastic.co/u/fsanzestevez)\
**Post date:** [November 3, 2022, 10:08am UTC](https://discuss.elastic.co/t/what-is-boost-in-similarity-score-function/318091/1 "2022-11-03T10:08:10Z")

</div>

Hi,

I have a question regarding the similarity function with BM25.

I understand _ **tf** _ and _ **idf** _. However it's not clear for me what the _ **boost** _ variable is and what it depends on.

When I get the explanation of the score for a document I get the following:

```auto
"explanation": {
        "value": 13.391564,
        "description": "weight(text:despierto in 165046) [PerFieldSimilarity], result of:",
        "details": [
            {
                "value": 13.391564,
                "description": "score(freq=3.0), computed as boost * idf * tf from:",
                "details": [
                    {
                        "value": 2.2,
                        "description": "boost",
                        "details": []
                    },

```

From what I have seen, boost is always a multiple of 2.2, but why is it sometimes 2.2, sometimes 4.4, or 6.6 etc?

Thank you in advance!

---

<div class="post-metadata">

**Author:** ![fsanzestevez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fsanzestevez/32/112675_2.png) [@fsanzestevez](https://discuss.elastic.co/u/fsanzestevez)\
**Post date:** [November 10, 2022, 4:36pm UTC](https://discuss.elastic.co/t/what-is-boost-in-similarity-score-function/318091/2 "2022-11-10T16:36:26Z")

</div>

I have found it myself through trial and error.

Turns out the 'boost' is part of [Okapi BM25](https://en.wikipedia.org/wiki/Okapi_BM25)

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/6/9/69c44bf658d98ff31502713d2782aae0431b825f.png)

By default, k1=1.2, therefore, in the numerator of the equation we have f(q\_i, D) \* (k\_1 + 1) = tf \* 2.2. This is the boosting part.  
The boost is simply tf **of the query** multiplied by (k\_1+1). So, if a term appears once in the query, the boost will be just 2.2. However, if a term appears **n** times, it will be **n\*2.2**.

---

<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:** [December 8, 2022, 4:37pm UTC](https://discuss.elastic.co/t/what-is-boost-in-similarity-score-function/318091/3 "2022-12-08T16:37:19Z")

</div>

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