Right now the below aggregation is not possible even though the 'nested_agg' does return a single bucket and nested aggregation is a single bucket aggregation.
Below sample aggregation generates an error message that says 'nested_agg' is not a single bucket aggregation and can not be in the order path.
{
buckets: {
terms: {
field: 'docId',
order: {'nested_agg>sum_value': 'desc'}
},
aggs: {
nested_agg: {
nested: {
path: 'my_nested_object'
},
aggs: {
sum_value: {
sum: {field: 'my_nested_object.value'}
}
}
}
}
}
}
Right now the below aggregation is not possible even though the 'nested_agg' does return a single bucket and nested aggregation is a single bucket aggregation.
Below sample aggregation generates an error message that says 'nested_agg' is not a single bucket aggregation and can not be in the order path.