# Filter by Count in Datatable

**URL:** <https://discuss.elastic.co/t/filter-by-count-in-datatable/187297>\
**Category:** Kibana\
**Created:** [June 25, 2019, 9:50am UTC](https://discuss.elastic.co/t/filter-by-count-in-datatable/187297 "2019-06-25T09:50:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![CraigMc](https://avatars.discourse-cdn.com/v4/letter/c/cdc98d/32.png) [@CraigMc](https://discuss.elastic.co/u/CraigMc)\
**Post date:** [June 25, 2019, 9:50am UTC](https://discuss.elastic.co/t/filter-by-count-in-datatable/187297/1 "2019-06-25T09:50:43Z")

</div>

I have a simple data table of events with the count of stages.

![image](https://us1.discourse-cdn.com/elastic/original/3X/e/b/eb606ced64c272f08835c08338b49efa56010c73.png)

In my example, a count of '7' indicates that the process has completed all stages.  
I want to filter this table for rows with a count \<\> 7.

I have seen the "min\_doc\_count" option ([https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html#\_minimum\_document\_count\_4](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html#_minimum_document_count_4)) which is similar to what I want to achieve but not exactly (as this would only identify events which have \> 7 but I can not identify anything \< 7 using this)

Any one know if I'm able to achieve what I'm after?

Thanks,  
C

---

<div class="post-metadata">

**Author:** ![nickpeihl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nickpeihl/32/112622_2.png) [@nickpeihl](https://discuss.elastic.co/u/nickpeihl)\
**Post date:** [June 26, 2019, 12:39am UTC](https://discuss.elastic.co/t/filter-by-count-in-datatable/187297/2 "2019-06-26T00:39:36Z")

</div>

It's not easily done right now. Here's an answer to a similar question that gives some options.

> [@How to filter visualization based on result of aggregate?](https://discuss.elastic.co/t/how-to-filter-visualization-based-on-result-of-aggregate/126669/3):
>
> hi @Steven_Ensslen, this is similar to a HAVING clause in SQL. Elasticsearch has something called a "bucket selector": [https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-bucket-selector-aggregation.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-bucket-selector-aggregation.html). This is likely what you'd want to use. This functionality is not available in Kibana though. There's an open ER for that: [https://github.com/elastic/kibana/issues/11167](https://github.com/elastic/kibana/issues/11167). If you think that's in-line with what you need, I would go and upvote that ticke…

---

<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 24, 2019, 12:45am UTC](https://discuss.elastic.co/t/filter-by-count-in-datatable/187297/3 "2019-07-24T00:45:11Z")

</div>

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