I used to inner_hits
to get number of child documents that matched under a parent document.
For that under the query I have
"inner_hits": {
"size": 0
}
which gives a response type
"inner_hits": {
"post": {
"hits": {
"total": 1334,
"max_score": 0,
"hits": []
}
}
}
under the parent document matched but the total
is actually the number of child documents that have been matched using has_child
query.
Suppose, I have a query
where I try to match some terms:
{
"bool": {
"should": [
{
"query_string": {
"query": "java",
"fields": [
"postContent"
]
}
},
{
"query_string": {
"query": "javascript",
"fields": [
"postContent"
]
}
}
]
}
}
For the top most parent matched I get total no. of children matched is 1334
. How can I get the no. of documents that matched java
and javascript
separately for each parent document?
It is something like aggregation on inner_hits
.