【问题标题】:multi_match malformed query, expected END_OBJECT but found FIELD_NAMEmulti_match 格式错误的查询,应为 END_OBJECT,但找到 FIELD_NAME
【发布时间】:2018-04-25 00:29:22
【问题描述】:
{
"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}],"type":"parsing_exception","re​​ason":"[multi_match]格式错误的查询,应为 [END_OBJECT],但找到了 [FIELD_NAME]","line":32,"col":13}

【问题讨论】:

    标签: elasticsearch


    【解决方案1】:

    您无需在multi_match 约束周围添加query

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

    【讨论】:

    • 酷,很高兴它有帮助!
    • 如果您认为合适,请随时提出新问题,人们肯定会帮助您:-)
    猜你喜欢
    • 2018-02-10
    • 2021-04-22
    • 2020-02-26
    • 1970-01-01
    • 2018-01-30
    • 2022-10-25
    • 2022-01-14
    • 2017-12-01
    • 2020-08-30
    相关资源
    最近更新 更多