We try to be as flexible as possible when it comes to sorting terms aggregations. However, sorting by anything but by _term or descending _count makes it very hard to return the correct top buckets and counts, which is disappointing to users. Instead, I suggest that we only allow order options that result in
reasonably accurate results:
- remove the ability to sort by ascending count
- remove ordering by sub aggregations entirely, or only allow when the leaf of the path is a
min or max aggregation: in that case counts will not be accurate but I believe that the top buckets will be correct.
We try to be as flexible as possible when it comes to sorting terms aggregations. However, sorting by anything but by
_termor descending_countmakes it very hard to return the correct top buckets and counts, which is disappointing to users. Instead, I suggest that we only alloworderoptions that result inreasonably accurate results:
minormaxaggregation: in that case counts will not be accurate but I believe that the top buckets will be correct.