Your query is malformed. You are using two queries here `nested` and `bool`. Both these queries must be wrapped in either `must`, `should` or `filter` of a bool query. Assuming both the condition are necessary for a match, both these queries should be wrapped in either `must` or `filter` clause of a `bool` query as below:
{
"query": {
"bool": {
"must": [
{
"nested": {
"path": "metadata",
"query": {
"bool": {
"should": [
{
"match": {
"metadata.deleted": true
}
}
]
}
}
}
},
{
"must": {
"term": {
"on_behalf_of": "b71457f731d8a6f"
}
}
}
]
}
}
}
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"
}
}
]
}
}
]
}
}
}