# Visualisation: How to perform order by over each group

**URL:** <https://discuss.elastic.co/t/visualisation-how-to-perform-order-by-over-each-group/167233>\
**Category:** Kibana\
**Created:** [February 6, 2019, 6:21am UTC](https://discuss.elastic.co/t/visualisation-how-to-perform-order-by-over-each-group/167233 "2019-02-06T06:21:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ashish\_94](https://avatars.discourse-cdn.com/v4/letter/a/58f4c7/32.png) [@ashish\_94](https://discuss.elastic.co/u/ashish_94)\
**Post date:** [February 6, 2019, 6:21am UTC](https://discuss.elastic.co/t/visualisation-how-to-perform-order-by-over-each-group/167233/1 "2019-02-06T06:21:36Z")

</div>

Elastic search stores docs where each doc has "api\_url", "client","req\_ms" column.  
I want to plot a visualization where I would like to aggregate(group by) docs by "client" column, then for each client group, order documents by "req\_ms" column and plot graph of each client versus top 10 slowest "api\_url".

---

<div class="post-metadata">

**Author:** ![Aaron\_Caldwell](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aaron_caldwell/32/45755_2.png) [@Aaron\_Caldwell](https://discuss.elastic.co/u/Aaron_Caldwell)\
**Post date:** [February 6, 2019, 5:19pm UTC](https://discuss.elastic.co/t/visualisation-how-to-perform-order-by-over-each-group/167233/2 "2019-02-06T17:19:54Z")

</div>

Hello Ashish,

it sounds like you might want to use a sub-aggregation, available towards the bottom of the menu when you're creating your visualization.

[https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket.html)

Thanks!  
Aaron

---

<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:** [March 6, 2019, 5:19pm UTC](https://discuss.elastic.co/t/visualisation-how-to-perform-order-by-over-each-group/167233/3 "2019-03-06T17:19:57Z")

</div>

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