# What is the boost factor of a should in a bool\_query?

**URL:** <https://discuss.elastic.co/t/what-is-the-boost-factor-of-a-should-in-a-bool-query/225163>\
**Category:** Elasticsearch\
**Created:** [March 26, 2020, 10:18am UTC](https://discuss.elastic.co/t/what-is-the-boost-factor-of-a-should-in-a-bool-query/225163 "2020-03-26T10:18:06Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![abemail1](https://avatars.discourse-cdn.com/v4/letter/a/c37758/32.png) [@abemail1](https://discuss.elastic.co/u/abemail1)\
**Post date:** [March 26, 2020, 10:18am UTC](https://discuss.elastic.co/t/what-is-the-boost-factor-of-a-should-in-a-bool-query/225163/1 "2020-03-26T10:18:06Z")

</div>

Hi,

I'm a newbie to elasticsearch and couldn't find the answer to this in the online docs.

I have a bool\_query with a **must** and a **should**. As I wanted the should part causes those results to be boosted.

However, what I can't find is what the default boost factor is when a **should** is matched? Is it possible to tweak this default boost factor?

Thank you

---

<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:** [March 26, 2020, 3:23pm UTC](https://discuss.elastic.co/t/what-is-the-boost-factor-of-a-should-in-a-bool-query/225163/2 "2020-03-26T15:23:09Z")

</div>

Welcome!

There's no "boost" factor as per say for should condition. It "just" adds the score of the should clauses to the score of the must clauses. Which effectively makes documents scoring higher.

---

<div class="post-metadata">

**Author:** ![abemail1](https://avatars.discourse-cdn.com/v4/letter/a/c37758/32.png) [@abemail1](https://discuss.elastic.co/u/abemail1)\
**Post date:** [March 26, 2020, 4:53pm UTC](https://discuss.elastic.co/t/what-is-the-boost-factor-of-a-should-in-a-bool-query/225163/3 "2020-03-26T16:53:17Z")

</div>

thanks dadoonet.

So different types of **should** s would have different scores?

In my current tests it seems to add 1 to the score when it matches the should.

---

<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:** [March 26, 2020, 5:07pm UTC](https://discuss.elastic.co/t/what-is-the-boost-factor-of-a-should-in-a-bool-query/225163/4 "2020-03-26T17:07:45Z")

</div>

Could you provide a full recreation script as described in [About the Elasticsearch category](https://discuss.elastic.co/t/about-the-elasticsearch-category/21). It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.

---

<div class="post-metadata">

**Author:** ![abemail1](https://avatars.discourse-cdn.com/v4/letter/a/c37758/32.png) [@abemail1](https://discuss.elastic.co/u/abemail1)\
**Post date:** [March 26, 2020, 5:33pm UTC](https://discuss.elastic.co/t/what-is-the-boost-factor-of-a-should-in-a-bool-query/225163/5 "2020-03-26T17:33:30Z")

</div>

Sure dadoonet:

Index:

```
{
    "settings": {
        "analysis": {
            "analyzer": {
                "auto_complete_a": {
                    "tokenizer": "whitespace",
                    "filter": [
                        "lowercase",
                        "filter_a"
                    ]
                }
            },
            "filter": {
                "filter_a": {
                    "type": "edge_ngram",
                    "min_gram": 3,
                    "max_gram": 7
                }
            }
        }
    },
    "mappings": {
        "properties": {
            "name": {
                "type": "text",
                "analyzer": "auto_complete_a"
            },
            "sku": {
                "type": "text"
            }
        }
    }
}

```

Using this query the matching record for 111111 is scored 16.67

```
{
    "query": {
        "bool": {
            "must": {
                "multi_match": {
                    "query": "sony"
                }
            },
            "should": {
                "terms": {
                    "sku": ["111111", "222222"]
                }
            }
        }
    }
}

```

However changing the should to a filter scores it as 15.67

```
{
    "query": {
        "bool": {
            "must": {
                "multi_match": {
                    "query": "sony"
                }
            },
            "filter": {
                "terms": {
                    "sku": ["111111", "222222"]
                }
            }
        }
    }
}

```

That's why I assumed that the **should** would add a score of 1

---

<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:** [March 26, 2020, 8:16pm UTC](https://discuss.elastic.co/t/what-is-the-boost-factor-of-a-should-in-a-bool-query/225163/6 "2020-03-26T20:16:57Z")

</div>

I can't reproduce without data. Could you share a full script please?

---

<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:** [April 23, 2020, 8:17pm UTC](https://discuss.elastic.co/t/what-is-the-boost-factor-of-a-should-in-a-bool-query/225163/7 "2020-04-23T20:17:06Z")

</div>

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