# Create query with list of users-id

**URL:** <https://discuss.elastic.co/t/create-query-with-list-of-users-id/25934>\
**Category:** Elasticsearch\
**Created:** [July 20, 2015, 5:44pm UTC](https://discuss.elastic.co/t/create-query-with-list-of-users-id/25934 "2015-07-20T17:44:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Smasell](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/smasell/32/43483_2.png) [@Smasell](https://discuss.elastic.co/u/Smasell)\
**Post date:** [July 20, 2015, 5:44pm UTC](https://discuss.elastic.co/t/create-query-with-list-of-users-id/25934/1 "2015-07-20T17:44:06Z")

</div>

Hi!  
I want to query list of all users who have more than 40 documents each.  
I've created aggregation:  
"aggs" : {  
"user-ids" : {  
"terms" : {  
"field" : "user-id",  
"size": 0  
}  
}  
}  
with all my users with response:  
{  
"key": 683696,  
"doc\_count": 4086  
},  
{  
"key": 678776,  
"doc\_count": 3625  
},  
{  
"key": 683191,  
"doc\_count": 3304  
},  
{  
"key": 684065,  
"doc\_count": 3287  
},  
.....  
I have to leave only buckets with "doc\_count" less than 40. Is it possible?

---

<div class="post-metadata">

**Author:** ![Smasell](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/smasell/32/43483_2.png) [@Smasell](https://discuss.elastic.co/u/Smasell)\
**Post date:** [July 21, 2015, 10:49am UTC](https://discuss.elastic.co/t/create-query-with-list-of-users-id/25934/2 "2015-07-21T10:49:23Z")

</div>

I've found only "min\_doc\_count". Where is something like "max\_doc\_count", I can't find it?

---

<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, 12:00am UTC](https://discuss.elastic.co/t/create-query-with-list-of-users-id/25934/3 "2017-07-06T00:00:12Z")

</div>


