Boosting has no effect in a Boolean-filtered query in Elasticsearch Boosting has no effect in a Boolean-filtered query in Elasticsearch elasticsearch elasticsearch

Boosting has no effect in a Boolean-filtered query in Elasticsearch


In the filter part of the query, boosting will have no effect, as the filters only job is to, ehhm, filter queries that match certain values. Try instead:

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

...moving the two term-queries directly into the should-clause in your top level bool query.