# Composite Aggregation - Document count

**URL:** <https://discuss.elastic.co/t/composite-aggregation-document-count/153322>\
**Category:** Elasticsearch\
**Created:** [October 22, 2018, 4:31am UTC](https://discuss.elastic.co/t/composite-aggregation-document-count/153322 "2018-10-22T04:31:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kdh6429](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kdh6429/32/31676_2.png) [@kdh6429](https://discuss.elastic.co/u/kdh6429)\
**Post date:** [October 22, 2018, 4:31am UTC](https://discuss.elastic.co/t/composite-aggregation-document-count/153322/1 "2018-10-22T04:31:35Z")

</div>

Does elasticsearch guarantee with exact document count in composite aggregation's result, unlike term aggregation? or is it approximate number just like terms aggregation?

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [October 22, 2018, 8:50am UTC](https://discuss.elastic.co/t/composite-aggregation-document-count/153322/2 "2018-10-22T08:50:37Z")

</div>

Yes, composite doc counts are accurate.  
Term aggs sort (by default) by popularity which can be uneven across shards.  
Composite agg sorts by key order which is a constant ordering across shards.

---

<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:** [November 19, 2018, 8:50am UTC](https://discuss.elastic.co/t/composite-aggregation-document-count/153322/3 "2018-11-19T08:50:38Z")

</div>

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