# Filter on bucket metric

**URL:** <https://discuss.elastic.co/t/filter-on-bucket-metric/103891>\
**Category:** Logstash\
**Created:** [October 13, 2017, 12:09pm UTC](https://discuss.elastic.co/t/filter-on-bucket-metric/103891 "2017-10-13T12:09:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![saramali](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@saramali](https://discuss.elastic.co/u/saramali)\
**Post date:** [October 13, 2017, 12:09pm UTC](https://discuss.elastic.co/t/filter-on-bucket-metric/103891/1 "2017-10-13T12:09:25Z")

</div>

I want to filter the results of a count metric.  
Suppose I want to show only the documents whose count is greater than x or less than x or equal.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [October 17, 2017, 6:49pm UTC](https://discuss.elastic.co/t/filter-on-bucket-metric/103891/2 "2017-10-17T18:49:08Z")

</div>

It's not entirely clear what you want to do but it sounds like you could use a conditional that wraps a drop filter.

```nohighlight
if [count] <= x {
  drop { }
}

```

See [https://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html](https://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html) for details.

---

<div class="post-metadata">

**Author:** ![saramali](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@saramali](https://discuss.elastic.co/u/saramali)\
**Post date:** [October 18, 2017, 6:51am UTC](https://discuss.elastic.co/t/filter-on-bucket-metric/103891/3 "2017-10-18T06:51:20Z")

</div>

I have been looking for the solution on the internet from quite a while and I'm still not sure that if it is possible on Kibana or not. Suppose I apply filter on term and it gives me count of the respective terms but I want the results to show only those terms where count equals a specific value. Being more specific, I want to find out the number of tills which are the most busy (most number of transactions). Currently when I apply a filter on term and count it shows me the all the tills with their respective transaction count. What I want is that to show only those tills where the count is equal to let's say 10. In other words a similar functionality like HAVING clause in relational dbms. I have found a lot of work arounds of the same usecase but I'm looking for a solution.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [October 18, 2017, 8:03am UTC](https://discuss.elastic.co/t/filter-on-bucket-metric/103891/4 "2017-10-18T08:03:03Z")

</div>

Okay, so it's not a count field but a computed aggregated count similar to a HAVING clause in SQL. I don't see how you could do this in Logstash.

---

<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 15, 2017, 8:03am UTC](https://discuss.elastic.co/t/filter-on-bucket-metric/103891/5 "2017-11-15T08:03:20Z")

</div>

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