Is it possible to use rescoring within a bool query?


(Christian) #1

This is what I attempted to do, but I receive the following error in line 31:
[multi_match] malformed query, expected [END_OBJECT] but found [FIELD_NAME]

Obviously, "rescore" is interpreted as a field name.

How to do this properly or is it impossible to use rescoring in this context?

{
  "query": {
    "bool": {
      "should": [
        {
            "multi_match" : {
                "query":    "Karl-Carstens-Straße",
                "fields": [ 
                  "street", 
                  "street.bigrams^2",
                  "street.exact^4"
                ],
                "type": "most_fields",
                "fuzziness": 1,
                "prefix_length": 2        
            }
        },
        {
            "multi_match" : {
                "query":    "Marketing GmbH",
                "fields": [ 
                  "name", 
                  "name.bigrams^2",
                  "name.exact^4"
                ],
                "type": "most_fields",
                "fuzziness": 1,
                "prefix_length": 2        
            },
           "rescore" : {
              "window_size" : 20,
              "query" : {
                "score_mode": "multiply",
                 "rescore_query" : {
                    "match_phrase" : {
                       "title" : {
                          "query" : "Marketing GmbH",
                          "slop" : 2
                       }
                    }
                 },
                 "query_weight" : 1,
                 "rescore_query_weight" : 1.5
              }
           }
        }          
      ],
    }
  }
}

(system) #2

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