# Aggregations return result with sum\_other\_doc\_count

**URL:** <https://discuss.elastic.co/t/aggregations-return-result-with-sum-other-doc-count/29578>\
**Category:** Elasticsearch\
**Created:** [September 18, 2015, 2:46pm UTC](https://discuss.elastic.co/t/aggregations-return-result-with-sum-other-doc-count/29578 "2015-09-18T14:46:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![code\_blue](https://avatars.discourse-cdn.com/v4/letter/c/7ea924/32.png) [@code\_blue](https://discuss.elastic.co/u/code_blue)\
**Post date:** [September 18, 2015, 2:46pm UTC](https://discuss.elastic.co/t/aggregations-return-result-with-sum-other-doc-count/29578/1 "2015-09-18T14:46:31Z")

</div>

When we are doing a terms aggregation we are getting buckets of keys but also some document count under " **sum\_other\_doc\_count**"

Why are we getting this? How can we bucket these documents?

---

<div class="post-metadata">

**Author:** ![code\_blue](https://avatars.discourse-cdn.com/v4/letter/c/7ea924/32.png) [@code\_blue](https://discuss.elastic.co/u/code_blue)\
**Post date:** [September 18, 2015, 3:09pm UTC](https://discuss.elastic.co/t/aggregations-return-result-with-sum-other-doc-count/29578/2 "2015-09-18T15:09:56Z")

</div>

Got it working.

Just in case some one faces the same issue:

Set **"size":0** in your aggregation query to get back all documents.

---

<div class="post-metadata">

**Author:** ![colings86](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/colings86/32/44960_2.png) [@colings86](https://discuss.elastic.co/u/colings86)\
**Post date:** [September 18, 2015, 4:06pm UTC](https://discuss.elastic.co/t/aggregations-return-result-with-sum-other-doc-count/29578/3 "2015-09-18T16:06:09Z")

</div>

You should be very careful setting `"size":0` in the terms aggregation. It does not scale well for high cardinality fields and can easily lead to OutOfMemoryErrors due to the aggregation request having to stream a lot of transient state from the shards to the coordinating node (the node dealing with the request form your app).

---

<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, 11:49pm UTC](https://discuss.elastic.co/t/aggregations-return-result-with-sum-other-doc-count/29578/4 "2017-07-05T23:49:25Z")

</div>


