# Sorting Kibana filters aggregation

**URL:** <https://discuss.elastic.co/t/sorting-kibana-filters-aggregation/52709>\
**Category:** Kibana\
**Created:** [June 14, 2016, 9:39am UTC](https://discuss.elastic.co/t/sorting-kibana-filters-aggregation/52709 "2016-06-14T09:39:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![patrickko](https://avatars.discourse-cdn.com/v4/letter/p/b38774/32.png) [@patrickko](https://discuss.elastic.co/u/patrickko)\
**Post date:** [June 14, 2016, 9:39am UTC](https://discuss.elastic.co/t/sorting-kibana-filters-aggregation/52709/1 "2016-06-14T09:39:47Z")

</div>

I have created a filters aggregation in Kibana in a data table. For every filter element, I have an associated aggregated count. However, I cannot find a way to sort the data table by the counts for each filter.

Is there a way to do this or is it not possible at the moment?

---

<div class="post-metadata">

**Author:** ![Joe\_Fleming](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joe_fleming/32/3561_2.png) [@Joe\_Fleming](https://discuss.elastic.co/u/Joe_Fleming)\
**Post date:** [June 14, 2016, 9:40pm UTC](https://discuss.elastic.co/t/sorting-kibana-filters-aggregation/52709/3 "2016-06-14T21:40:43Z")

</div>

Maybe I'm not understanding what you're using for your filter aggs, but sort the data in the table seems to work for me. Is this not what you mean?

![](https://us1.discourse-cdn.com/elastic/original/2X/3/34bce095b5b103e49e0759fdc53fcb2b74b60008.gif)

---

<div class="post-metadata">

**Author:** ![patrickko](https://avatars.discourse-cdn.com/v4/letter/p/b38774/32.png) [@patrickko](https://discuss.elastic.co/u/patrickko)\
**Post date:** [June 15, 2016, 6:40am UTC](https://discuss.elastic.co/t/sorting-kibana-filters-aggregation/52709/4 "2016-06-15T06:40:48Z")

</div>

You can indeed get the correct order in the table by sorting that column. However, I would like this order to be persisted so that the visualisation can be put in a dashboard with that specific order.

A way too keep the table sorted by a certain column would also do fine, but the order in that table is reset every time the table is refreshed as far as I know.

---

<div class="post-metadata">

**Author:** ![Joe\_Fleming](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joe_fleming/32/3561_2.png) [@Joe\_Fleming](https://discuss.elastic.co/u/Joe_Fleming)\
**Post date:** [June 15, 2016, 4:47pm UTC](https://discuss.elastic.co/t/sorting-kibana-filters-aggregation/52709/5 "2016-06-15T16:47:12Z")

</div>

Ah, I see what you mean. Persisting user interaction (ie. clicking on the columns and sorting the data, and keeping it sorted that way) had been planned for a while, and has now [been completed and merged](https://github.com/elastic/kibana/issues/3721). I believe shipped in the last alpha release of 5.0.

Unfortunately, I don't believe there are any plans to backport that to the 4.x series.

---

<div class="post-metadata">

**Author:** ![patrickko](https://avatars.discourse-cdn.com/v4/letter/p/b38774/32.png) [@patrickko](https://discuss.elastic.co/u/patrickko)\
**Post date:** [June 15, 2016, 7:32pm UTC](https://discuss.elastic.co/t/sorting-kibana-filters-aggregation/52709/6 "2016-06-15T19:32:27Z")

</div>

Great that it will be possible in Kibana 5. Seems like a very useful feature to me.

I would have happily tried out Kibana 5, but it is not feasible at the time to setup an ES 5 cluster as well, which unfortunately is required.  
Thanks for your answers.

---

<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:** [July 6, 2017, 1:50pm UTC](https://discuss.elastic.co/t/sorting-kibana-filters-aggregation/52709/7 "2017-07-06T13:50:26Z")

</div>


