# Facets performance: want to know just if has at least one item

**URL:** <https://discuss.elastic.co/t/facets-performance-want-to-know-just-if-has-at-least-one-item/245170>\
**Category:** Elasticsearch\
**Created:** [August 16, 2020, 11:30pm UTC](https://discuss.elastic.co/t/facets-performance-want-to-know-just-if-has-at-least-one-item/245170 "2020-08-16T23:30:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cristianossd](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cristianossd/32/73966_2.png) [@cristianossd](https://discuss.elastic.co/u/cristianossd)\
**Post date:** [August 16, 2020, 11:30pm UTC](https://discuss.elastic.co/t/facets-performance-want-to-know-just-if-has-at-least-one-item/245170/1 "2020-08-16T23:30:50Z")

</div>

Hi, everyone!

Consider that I have million of documents with its categories A, B and C. I am searching to show the query results and requesting the facets (for a filter) to know if these categories have documents. But, the facets retrieve a counter of all documents (based on given query), but I want to know just if the category has at least one item. How can I improve this aggregation preventing facets to count every (million) documents?

---

<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:** [September 13, 2020, 11:30pm UTC](https://discuss.elastic.co/t/facets-performance-want-to-know-just-if-has-at-least-one-item/245170/2 "2020-09-13T23:30:52Z")

</div>

Closed on September 13, 2020, 11:30pm UTC

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