Elasticsreach boosting query by field value

48 Views Asked by At

I want to search in documents which some words in one filed are more important than others,

For example:

US intelligence believes North Korea is making more nuclear bomb fuel despite talks

Is there a way to Elasticsearch understand it? Some thing like this:

US^5 intelligence believes (North Korea)^10 is making more (nuclear bomb)^8 fuel despite talks
1

There are 1 best solutions below

0
On

There is a Dynamic boosting method suggested here

What they do is two have 2 (or more) queries, and boost them differently, e.g.

{
  "query": {
    "bool": {
      "should": [
        {
          "match": {
            "MyFieldName": {
              "query": "nuclear bomb",
              "boost": 8
            }
          }
        },
        {
          "match": { 
            "content": "other query terms there"
          }
        }
      ]
    }
  }
}