Secondary sort on aggregation buckets

I started investigating switching from facets to aggregations in order to
have access to some of the new features aggregations offer.

One of them is the ability to sort on a sub-aggregation metric, which is
working well, but the buckets that are tied come back in a random order.
Since it is not possible to sort the buckets of a stats aggregation (the
sub aggregation), there is no explicit secondary order. Is there any way to
setup the sub aggregations to be returned in order? Default order (count)
is fine.

The gist of the aggregations is

"aggs": {
"myagg": {
"terms": {
"field": "myfield",
"order": {
"maxotherfield": "desc"
},
"size": 100
},
"aggs": {
"maxotherfield": {
"max": {
"field": "someotherfield"
}
}
}
}
}

Haven't looked at the code much, but there is definitely no direct support
for secondary sorts.

Cheers,

Ivan

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDr39Fys73U%3Daz1ry4k2JRWMJb7QmFJvQBAXrE8DYGixg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.