# Sort by aggregations on nested?

**URL:** <https://discuss.elastic.co/t/sort-by-aggregations-on-nested/157322>\
**Category:** Elasticsearch\
**Created:** [November 19, 2018, 9:54am UTC](https://discuss.elastic.co/t/sort-by-aggregations-on-nested/157322 "2018-11-19T09:54:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomm](https://avatars.discourse-cdn.com/v4/letter/t/c0e974/32.png) [@tomm](https://discuss.elastic.co/u/tomm)\
**Post date:** [November 19, 2018, 9:54am UTC](https://discuss.elastic.co/t/sort-by-aggregations-on-nested/157322/1 "2018-11-19T09:54:43Z")

</div>

Hi, I have following query:

sorry, I couldn't find how to insert formatted json, tried 4 spaces, but failed, so I put my mapping, sample data and query here: [https://www.paste.org/96051](https://www.paste.org/96051)  
I hope that's ok

how can I introduce sort, so in "variants" I'd get variants sorted by price? is it possible to sort offers\>variants bucket by offers\>variants\>variant\>variant-sum value?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 17, 2018, 9:54am UTC](https://discuss.elastic.co/t/sort-by-aggregations-on-nested/157322/2 "2018-12-17T09:54:54Z")

</div>

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