multi_match格式错误的查询,预计END_OBJECT但找到了FIELD_NAME

时间:2017-11-12 04:29:55

标签: elasticsearch

{
"from":0,
"size":1000,
   "query": {
      "bool": {
         "must": [
         {
               "query": {

"multi_match": {
     "query": "shampoo",
     "fields": ["summary.exact", "promotionid.basic"],
     "type": "cross_fields",
     "minimum_should_match" : "100%"
}
}
},
       {
        "bool": {
                    "should": [
                        {"term": {"is_non_ecomm": "1"}}                            
                    ],
                    "must": [
                       {"term": {
                          "iscouponactive": "1"
                       }}
                    ]
                }
                }
     ]

      }
   }
}

我正在从2x迁移到5x并且我的查询失败了。这是我得到的错误:

  

[multi_match]格式错误的查询,预计[END_OBJECT]但找到[FIELD_NAME]"," line":32," col":13}],&#34 ;键入":" parsing_exception","原因":" [multi_match]格式错误的查询,预期[END_OBJECT]但找到[FIELD_NAME]",&# 34;线":32," COL":13}

1 个答案:

答案 0 :(得分:2)

您不需要在query约束条件下添加multi_match

{
  "from": 0,
  "size": 1000,
  "query": {
    "bool": {
      "must": [
        {
          "multi_match": {
            "query": "shampoo",
            "fields": [
              "summary.exact",
              "promotionid.basic"
            ],
            "type": "cross_fields",
            "minimum_should_match": "100%"
          }
        },
        {
          "bool": {
            "should": [
              {
                "term": {
                  "is_non_ecomm": "1"
                }
              }
            ],
            "must": [
              {
                "term": {
                  "iscouponactive": "1"
                }
              }
            ]
          }
        }
      ]
    }
  }
}