# Min\_doc\_count Not working with Cardinality aggregate

**URL:** <https://discuss.elastic.co/t/min-doc-count-not-working-with-cardinality-aggregate/58763>\
**Category:** Elasticsearch\
**Created:** [August 24, 2016, 4:47am UTC](https://discuss.elastic.co/t/min-doc-count-not-working-with-cardinality-aggregate/58763 "2016-08-24T04:47:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bkursar](https://avatars.discourse-cdn.com/v4/letter/b/47e85d/32.png) [@bkursar](https://discuss.elastic.co/u/bkursar)\
**Post date:** [August 24, 2016, 4:47am UTC](https://discuss.elastic.co/t/min-doc-count-not-working-with-cardinality-aggregate/58763/1 "2016-08-24T04:47:21Z")

</div>

I am trying to get a distinct list of user ids out of ElasticSearch where the user id was in more than one document across about 100M records.

Min\_doc\_count works fine if you are doing normal aggregate counts however if you change the aggregate to a cardinality aggregation, the Min\_doc\_count applies only to the total doc count that make up the aggregate and not the total unique counts within the aggregate.

Has anyone come up with a workaround for this?

---

<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 5, 2017, 10:25pm UTC](https://discuss.elastic.co/t/min-doc-count-not-working-with-cardinality-aggregate/58763/2 "2017-07-05T22:25:43Z")

</div>


