# Does setting a high size in terms aggregation affect memory usage if the actual bucket count is low?

**URL:** <https://discuss.elastic.co/t/does-setting-a-high-size-in-terms-aggregation-affect-memory-usage-if-the-actual-bucket-count-is-low/377060>\
**Category:** Elasticsearch\
**Created:** [April 12, 2025, 1:35am UTC](https://discuss.elastic.co/t/does-setting-a-high-size-in-terms-aggregation-affect-memory-usage-if-the-actual-bucket-count-is-low/377060 "2025-04-12T01:35:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lostpeacock](https://avatars.discourse-cdn.com/v4/letter/l/977dab/32.png) [@lostpeacock](https://discuss.elastic.co/u/lostpeacock)\
**Post date:** [April 12, 2025, 1:35am UTC](https://discuss.elastic.co/t/does-setting-a-high-size-in-terms-aggregation-affect-memory-usage-if-the-actual-bucket-count-is-low/377060/1 "2025-04-12T01:35:54Z")

</div>

I'm using a `terms` aggregation in Elasticsearch and have a question about the `size` parameter. Let's say I set `size: 1000`, but in reality, the number of buckets generated is always much lower—around 150 at most.

My question is: **Does specifying a larger `size` value (like 1000) cause significantly higher memory usage, even if the actual number of buckets created never exceeds 150?**

I'm trying to understand whether it's more efficient to set the size closer to the expected bucket count, or if having a higher value has negligible impact when the actual data doesn't require that many buckets.

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 12, 2025, 8:30am UTC](https://discuss.elastic.co/t/does-setting-a-high-size-in-terms-aggregation-affect-memory-usage-if-the-actual-bucket-count-is-low/377060/2 "2025-04-12T08:30:14Z")

</div>

Welcome!

> [@lostpeacock](#):
>
> **Does specifying a larger `size` value (like 1000) cause significantly higher memory usage, even if the actual number of buckets created never exceeds 150?**

No. I don't think it's a problem.
