Boosting has no effect in a Bool-Filter query

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?

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

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"
                }
              }
            }
          ]
        }
      }
    }
  }
}'

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