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

      }
   }
}

I am migrating from 2x to 5x and my query is failing. This is the error I am getting:

[multi_match] malformed query, expected [END_OBJECT] but found [FIELD_NAME]","line":32,"col":13}],"type":"parsing_exception","reason":"[multi_match] malformed query, expected [END_OBJECT] but found [FIELD_NAME]","line":32,"col":13}

1

1 Answers

5
votes

You don't need to add query around the multi_match constraint:

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