Is it possible to create sub aggregation with addAggregation()?
My problem: I would like to realize something like that…
{
"aggregations": {
"group": {
"nested": {
"path": "group_path"
},
"aggregations": {
"path_id": {
"terms": {
"field": "group_path.group_id",
"size": 0
},
"aggregations": {
"path_name": {
"terms": {
"field": "group_path.group_name",
"size": 1
}
}
}
}
}
}
}
}
If i try to do it with addAggregation():
...
$query->addAggregation('group', 'nested', ["path": "group_path"]);
$query->addAggregation('path_id', 'terms', ["field": "group_path.group_id", "size": 0]);
$query->addAggregation('path_name', 'terms', ["field": "group_path.group_name", "size": 1]);
...
It will produce me something like that:
{
"aggregations": {
"group": {
"nested": {
"path": "group_path"
}
},
"path_id": {
"terms": {
"field": "group_path.group_id",
"size": 0
}
},
"path_name": {
"terms": {
"field": "group_path.group_name",
"size": 1
}
}
}
}
Thank you in advance for any hint/help