Performance for bool query and rescoring


(Joey Liu) #1

Hello,

I have a question related to bool query and rescore, as the example below I'm using a must query for select documents and then use should to boost the score, does the should been only calculated on the results returned from must? If the should needs to be re-calculated against all documents again, is it wise to use rescore query in this case?

From all online examples people only use rescore on slow query like match_phrase, but if my index has huge amount of documents I'm wandering should I use recore on the shingle field?

Thank you.

GET my_index/description/_search
{
  "explain": true, 
  "query": {
    "bool": {
      "must": {
        "common": {
          "description": {
            "query": "test keywords bla bla",
            "minimum_should_match": {
               "low_freq": "50%",
               "high_freq": "75%"
            },
            "cutoff_frequency": 0.002,
            "boost": 3
          }
        }
      },
      "should": [
        {
          "multi_match": {
            "query": "test keywords bla bla",
            "fields": ["description.shingles", "description.origin"],
            "tie_breaker": 0.3
          }
        },
        {
          "term": {
            "hierarchy": "disorder"
          }
        },
        {
          "term": {
            "descriptionstatus": 0
          }
        }
      ]
    }
  }
}

(system) #2