I need to make multi_match and bool query at once, but query below doesn’t work 🙁 When I use them separatley, they working perfect.

{
  "query": {
    "multi_match": {
      "query": "kotlety*",
      "fields": [
        "name"
      ]
    },
    "bool": {
      "filter": {
        "term": {
          "status": 2
        }
      }
    }
  },
  "size": 24
}

response is:

{
    "error": {
        "root_cause": [
            {
                "type": "parsing_exception",
                "reason": "[multi_match] malformed query, expected [END_OBJECT] but found [FIELD_NAME]",
                "line": 9,
                "col": 5
            }
        ],
        "type": "parsing_exception",
        "reason": "[multi_match] malformed query, expected [END_OBJECT] but found [FIELD_NAME]",
        "line": 9,
        "col": 5
    },
    "status": 400
}

Elastic 6.6, I think my query can have wrong syntax?

The query can’t contain both a bool and a multi_match. You could re-arrange it like this:

{
  "query": {
    "bool": {
      "filter": {
        "term": {
          "status": 2
        }
      },
      "should": {
        "multi_match": {
        "query": "kotlety*",
        "fields": [
          "name"
        ]
      }
    }
  }
  },
  "size": 24
}

I changed syntax and this query works:

{
  "query": {
    "bool": {
      "must": {
        "multi_match": {
          "query": "kotlety*",
          "fields": [
            "name"
          ]
        }
      },
      "filter": {
        "term": {
          "status": 2
        }
      }
    }
  }
}