# Possibility of sorting and filtering the bucket keys as part of Term aggregation in Bar graph?

**URL:** https://discuss.elastic.co/t/possibility-of-sorting-and-filtering-the-bucket-keys-as-part-of-term-aggregation-in-bar-graph/250154
**Category:** Kibana
**Created:** [September 28, 2020, 9:30am UTC](https://discuss.elastic.co/t/possibility-of-sorting-and-filtering-the-bucket-keys-as-part-of-term-aggregation-in-bar-graph/250154 "2020-09-28T09:30:47Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![parallelthought](https://avatars.discourse-cdn.com/v4/letter/p/35a633/32.png) [@parallelthought](https://discuss.elastic.co/u/parallelthought)
#### Post date: [September 28, 2020, 9:30am UTC](https://discuss.elastic.co/t/possibility-of-sorting-and-filtering-the-bucket-keys-as-part-of-term-aggregation-in-bar-graph/250154/1 "2020-09-28T09:30:47Z")

</div>

I'm trying to visualize a particular usecase described below, I'm unable to figure our if such a way is possible on Kibana (Timelion or Vertical graph). Appreciate any help/suggestion

**Usecase** : Every ES doc contains a username belonging to an organisation with the number of exports done (possibly multiple times a day). I'm trying to visualise all the usernames which have exported beyond a particular threshold value (say 100) on a daily basis.

**Kibana Viz** : Along with the Sum metric aggregation, I'm able to make use of term & histogram aggregation to visualize the total exports for all the users on a daily basis. However I would like to filter out the usernames (terms) which have total exports below a threshold (sort and filter) and not display them on the Viz.

---

<div class="post-metadata">

### Author: ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)
#### Post date: [October 5, 2020, 5:49pm UTC](https://discuss.elastic.co/t/possibility-of-sorting-and-filtering-the-bucket-keys-as-part-of-term-aggregation-in-bar-graph/250154/2 "2020-10-05T17:49:01Z")

</div>

Hello,

This is possible indeed. Just create your visualization and in the Advanced JSON when you do a split per username, you need to add `"min_doc_count": 10` where 10 is the value you want.

---

<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: [November 2, 2020, 5:49pm UTC](https://discuss.elastic.co/t/possibility-of-sorting-and-filtering-the-bucket-keys-as-part-of-term-aggregation-in-bar-graph/250154/3 "2020-11-02T17:49:14Z")

</div>

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