Cannot figure out the syntax for aggregations per the doc for this. Would think this type of request is very common...
{
"bible-book": {
"mappings": {
"properties": {
"book": {
"type": "text"
},
"chapters": {
"type": "nested",
"properties": {
"chapter": {
"type": "integer"
},
"verses": {
"type": "nested",
"properties": {
"text": {
"type": "text",
"analyzer": "english"
},
"verse": {
"type": "integer"
}
}
}
}
}
}
}
}
}
POST bible-book/_search
{
"_source": false,
"query": {
"nested": {
"path": "chapters.verses",
"query": {
"match": {
"chapters.verses.text": "consolation"
}
},
"inner_hits": {}
}
}
}
"hits": {
"total": {
"value": 11,
"relation": "eq"
},
"max_score": 9.562649,
"hits": [
{
"_index": "bible-book",
"_id": "18",
"_score": 9.562649,
"inner_hits": {
"chapters.verses": {
"hits": {
"total": {
"value": 2, <==== want the summation of this for inner_hits
"relation": "eq"
},
"max_score": 9.7188