# Boosting has no effect in a Bool-Filter query

**URL:** https://discuss.elastic.co/t/boosting-has-no-effect-in-a-bool-filter-query/70891
**Category:** Elasticsearch
**Created:** [January 8, 2017, 5:35pm UTC](https://discuss.elastic.co/t/boosting-has-no-effect-in-a-bool-filter-query/70891 "2017-01-08T17:35:58Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![muwnd](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/muwnd/32/14389_2.png) [@muwnd](https://discuss.elastic.co/u/muwnd)
#### Post date: [January 8, 2017, 5:35pm UTC](https://discuss.elastic.co/t/boosting-has-no-effect-in-a-bool-filter-query/70891/1 "2017-01-08T17:35:58Z")

</div>

I'm trying to add a boost to documents that match to a term filter. The basis is a Boolean/MatchAll query. But the boosting in my Elasticsearch query has no effect. All result scores are set to 1:

```
curl -XPOST localhost:9200/wiki_content/_search?pretty -d '
{
  "_source": [
    "title"
  ],
  "query": {
    "bool": {
      "must": [
        {
          "match_all": {}
        }
      ],
      "filter": [
        {
          "bool": {
            "should": [
              {
                "term": {
                  "title.keyword": {
                    "value": "Main Page",
                    "boost": 9
                  }
                }
              },
              {
                "term": {
                  "title.keyword": {
                    "value": "Top Page",
                    "boost": 999
                  }
                }
              }
            ]
          }
        }
      ]
    }
  }
}
'

```

However, when using a filtered query, the boosting works. But due to restrictions in my system I cannot use a filtered query. So is there any method to make the boosting in the original query work?

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [January 8, 2017, 11:51pm UTC](https://discuss.elastic.co/t/boosting-has-no-effect-in-a-bool-filter-query/70891/2 "2017-01-08T23:51:05Z")

</div>

Boolean scores are either 1 (ie match) or 0 (no match), literally true or false. You cannot alter that.

---

<div class="post-metadata">

### Author: ![muwnd](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/muwnd/32/14389_2.png) [@muwnd](https://discuss.elastic.co/u/muwnd)
#### Post date: [January 9, 2017, 8:22am UTC](https://discuss.elastic.co/t/boosting-has-no-effect-in-a-bool-filter-query/70891/3 "2017-01-09T08:22:11Z")

</div>

I found that with a filtered query it works. However, I'm restricted by the system to use only a MatchAll + Filter query. Is this still possible?

```
curl -XPOST localhost:9200/wiki_content/_search?pretty -d '
{
  "_source": [
    "title"
  ],
  "query": {
    "filtered": {
      "query": {
        "bool": {
          "should": [
            {
              "term": {
                "title.keyword": {
                  "boost": 1,
                  "value": "Top Page"
                }
              }
            },
            {
              "term": {
                "title.keyword": {
                  "boost": 100,
                  "value": "Main Page"
                }
              }
            },
            {
              "term": {
                "title.keyword": {
                  "boost": 10,
                  "value": "Some Page"
                }
              }
            }
          ]
        }
      }
    }
  }
}'
```

---

<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: [February 6, 2017, 8:22am UTC](https://discuss.elastic.co/t/boosting-has-no-effect-in-a-bool-filter-query/70891/4 "2017-02-06T08:22:11Z")

</div>

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