How to get exact number of buckets returned with too_many_buckets_exception

Like many people - I've received the too_many_buckets_exception error with an unoptimized query. How can we get the actual number of buckets returned that triggered this error?

the total buckets are not calculated, but the execution is aborted if that limit is exceeded.

you could maybe use a cardinality aggregation to get a an estimate how many buckets would be created by changing your query

1 Like

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