I need a query in which I can aggregate on multiple fields -4 fields to be more specific- and as far as I understand, the only way to create such a query is using nested aggregations. But when that's the case, I have two problems:
1- I could not find a way to limit the total number of inner-most buckets
2- I could not find a way to order by the inner-most buckets so that I can retrieve the top N of them according to their values.
I'd be glad if anyone can help me get rid of this mess.
Thank you all in advance!