Has_child query with multiple clauses


(Atul Bagga) #1

I am trying to query for parent documents containing children which match my query clauses.

Query could be of the form A AND B or A OR B etc.

On forming a query for find parents where children name or Description contains "word1" AND "word2" something like this..

"has_child": {
"type": "ChildType",
"score_mode": "sum",
"bool": {
"must": [
{
"multi_match": {
"query": "word1",
"fields": [
"name",
"description"
]
}
},
{
"multi_match": {
"query": "word2",
"fields": [
"name",
"description"
]
}
}]
},
"inner_hits": {
"size": 2,
}

I am getting parsing exception "[has_child] query does not support [bool]". Is there a way to achieve what I am trying to do?


(Atul Bagga) #2

My bad.. the bool query should be enclosed in a "query" and it works.


(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.