How to add sorting to multi bucket aggregation?

Hi!

I have some mapping with sample data, and also query aggregating that data, that works ALMOST like I want it - thanks to "size": 1 it gets me only one variant.. but I'd like it to get cheapest, so I'm missing sorting by price.
here's my query: https://gist.github.com/maur/7acb7ac4f36196e6a5f251ee5289ec6a

I tried in "sort" putting variant-sum>_count, variant-sum>sum-filter.. and many, really many other options. Is it even possible in this place to sort by summed price?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.