# Data Table - Max Bucket Limit - too\_many\_buckets\_exception

**URL:** <https://discuss.elastic.co/t/data-table-max-bucket-limit-too-many-buckets-exception/304342>\
**Category:** Elasticsearch\
**Created:** [May 10, 2022, 12:12pm UTC](https://discuss.elastic.co/t/data-table-max-bucket-limit-too-many-buckets-exception/304342 "2022-05-10T12:12:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sasank.vemana](https://avatars.discourse-cdn.com/v4/letter/s/94ad74/32.png) [@sasank.vemana](https://discuss.elastic.co/u/sasank.vemana)\
**Post date:** [May 10, 2022, 12:12pm UTC](https://discuss.elastic.co/t/data-table-max-bucket-limit-too-many-buckets-exception/304342/1 "2022-05-10T12:12:43Z")

</div>

"Trying to create too many buckets. Must be less than or equal to: [65535] but was [65536]. This limit can be set by changing the [search.max\_buckets] cluster level setting."

When working with a data table, we run into this error at times. I want to understand how this limit is reached. I know the bucket size limit is reached due to the volume of data, number and size of buckets. But can someone please explain this with a simple example?  
I am trying to understand this possibly with a simple formula:  
For example: metric size + (split rows \* bucket size)... = final size

Let's assume I am using a metric of 'Top Hit'... Aggregate with concatenate and Size of 1.  
Please let me know if I can explain this better.

---

<div class="post-metadata">

**Author:** ![Tomo\_M](https://avatars.discourse-cdn.com/v4/letter/t/848f3c/32.png) [@Tomo\_M](https://discuss.elastic.co/u/Tomo_M)\
**Post date:** [May 13, 2022, 5:50am UTC](https://discuss.elastic.co/t/data-table-max-bucket-limit-too-many-buckets-exception/304342/2 "2022-05-13T05:50:18Z")

</div>

Hi,  
Could you share the aggregation query causing the exception?

The exception means literally too many number of buckets. When you are using multiple sub-aggregation, the total number of buckets could be exponentially high. Also I wonder if you are using [bucket selector aggregation](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-bucket-selector-aggregation.html). As it works AFTER creating buckets, it has no effect to avoid the exception.

---

<div class="post-metadata">

**Author:** ![sasank.vemana](https://avatars.discourse-cdn.com/v4/letter/s/94ad74/32.png) [@sasank.vemana](https://discuss.elastic.co/u/sasank.vemana)\
**Post date:** [May 13, 2022, 11:46am UTC](https://discuss.elastic.co/t/data-table-max-bucket-limit-too-many-buckets-exception/304342/3 "2022-05-13T11:46:07Z")

</div>

I am actually looking for a simple example to understand how the buckets will get generated in a basic scenario (even if the max is not reached). This is just for my understanding (not to solve a particular issue).

---

<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:** [June 10, 2022, 11:46am UTC](https://discuss.elastic.co/t/data-table-max-bucket-limit-too-many-buckets-exception/304342/4 "2022-06-10T11:46:08Z")

</div>

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