# Something like min\_doc\_count, but for maximum document count

**URL:** https://discuss.elastic.co/t/something-like-min-doc-count-but-for-maximum-document-count/162976
**Category:** Kibana
**Created:** [January 4, 2019, 2:57pm UTC](https://discuss.elastic.co/t/something-like-min-doc-count-but-for-maximum-document-count/162976 "2019-01-04T14:57:59Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![pszemesy](https://avatars.discourse-cdn.com/v4/letter/p/e8c25b/32.png) [@pszemesy](https://discuss.elastic.co/u/pszemesy)
#### Post date: [January 4, 2019, 2:57pm UTC](https://discuss.elastic.co/t/something-like-min-doc-count-but-for-maximum-document-count/162976/1 "2019-01-04T14:57:59Z")

</div>

I have to create a visualization (Data Table) based on the it sec logs.  
The requirement is to summarize the branches where were less than 3 logins per day.  
So I have created a Metric(Count), added split row with timestamp interval: daily and another split row terms: branch.  
And now I need a filter something like min\_doc\_count but for max\_doc\_count.  
I have tried to add into "JSON input": { "script": "params.doc\_count \< 3" } - but that is not worked.  
Please suggest me something how to do that!  
Thanks

---

<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: [January 5, 2019, 12:05am UTC](https://discuss.elastic.co/t/something-like-min-doc-count-but-for-maximum-document-count/162976/2 "2019-01-05T00:05:26Z")

</div>

There is no max\_doc\_count in Elasticsearch for the reasons described in [https://github.com/elastic/elasticsearch/issues/21714](https://github.com/elastic/elasticsearch/issues/21714).

The workaround in that issue may work as a query in Elasticsearch, but it uses a bucket\_selector aggregation which is not yet supported in Kibana (see [https://github.com/elastic/kibana/issues/17544](https://github.com/elastic/kibana/issues/17544)).

---

<div class="post-metadata">

### Author: ![pszemesy](https://avatars.discourse-cdn.com/v4/letter/p/e8c25b/32.png) [@pszemesy](https://discuss.elastic.co/u/pszemesy)
#### Post date: [January 7, 2019, 5:48am UTC](https://discuss.elastic.co/t/something-like-min-doc-count-but-for-maximum-document-count/162976/3 "2019-01-07T05:48:44Z")

</div>

Thanks!

---

<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: [February 4, 2019, 6:01am UTC](https://discuss.elastic.co/t/something-like-min-doc-count-but-for-maximum-document-count/162976/4 "2019-02-04T06:01:16Z")

</div>

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