# Is it possible to use rescoring within a bool query?

**URL:** <https://discuss.elastic.co/t/is-it-possible-to-use-rescoring-within-a-bool-query/148829>\
**Category:** Elasticsearch\
**Created:** [September 17, 2018, 12:06pm UTC](https://discuss.elastic.co/t/is-it-possible-to-use-rescoring-within-a-bool-query/148829 "2018-09-17T12:06:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cads](https://avatars.discourse-cdn.com/v4/letter/c/e47c2d/32.png) [@cads](https://discuss.elastic.co/u/cads)\
**Post date:** [September 17, 2018, 12:06pm UTC](https://discuss.elastic.co/t/is-it-possible-to-use-rescoring-within-a-bool-query/148829/1 "2018-09-17T12:06:35Z")

</div>

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
              }
           }
        }          
      ],
    }
  }
}
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 15, 2018, 12:06pm UTC](https://discuss.elastic.co/t/is-it-possible-to-use-rescoring-within-a-bool-query/148829/2 "2018-10-15T12:06:45Z")

</div>

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