Elasticsearch:是否可以在布尔查询中使用记录?

时间:2018-09-17 08:25:55

标签: elasticsearch

这是我试图做的,但是我在第31行收到以下错误:

[multi_match]格式错误的查询,预期[END_OBJECT],但发现了[FIELD_NAME]

显然,“ rescore”被解释为字段名称。

如何正确执行此操作,或者在这种情况下不可能使用记录?

{
  "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
              }
           }
        }          
      ],
    }
  }
}

0 个答案:

没有答案