# Too\_many\_buckets\_exception

**URL:** <https://discuss.elastic.co/t/too-many-buckets-exception/216671>\
**Category:** Elasticsearch\
**Created:** [January 27, 2020, 2:15pm UTC](https://discuss.elastic.co/t/too-many-buckets-exception/216671 "2020-01-27T14:15:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pieter\_Agenbag](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pieter_agenbag/32/4562_2.png) [@Pieter\_Agenbag](https://discuss.elastic.co/u/Pieter_Agenbag)\
**Post date:** [January 27, 2020, 2:15pm UTC](https://discuss.elastic.co/t/too-many-buckets-exception/216671/1 "2020-01-27T14:15:46Z")

</div>

Hi... I have a too\_many\_buckets\_exception problem. I have read some of the other related questions and although the composite aggregation did help to a certain degree ... it does not seem to support auto\_date\_histogram

My query ..seen below , does a simple terms aggregation (and in this case its limited to a single "attribute" term) and then sub-aggregated on auto\_date\_histogram and finally a min metric aggregation.  
Sure I'm querying 180 indexes , but seeing how I only have 1 "Attribute" term and specifying only 20 buckets to the auto\_date\_historgram , i didnt expect it to be a problem ?

From what I understand of how the auto\_date\_histogram works (and its not a lot) ...it merges buckets at collection time , from smaller into larger buckets to maintain the "target amount" of buckets ... which in turn suggested to me that the number of indexes /shards should not play a major role in the equation. Or would it still roll up the buckets per shard and then collate them at the end ?

Regardless... any suggestions then how to get auto\_date\_histogram working across a large number of indices ? (a composite aggregation with fixed calendar\_interval does work ..but adds additional challenges and will end up requiring additional queries)

P.S. I'm on ES 7.5

```
GET performance.graph-*/_search
{
  "size": 0,
  "aggs": {
    "attribute": {
      "terms": {
        "field": "attribute"
      },
      "aggs": {
        "datehisto": {
          "auto_date_histogram": {
            "field": "timestamp",
            "buckets": 20
          },
          "aggs": {
            "min": {
              "min": {
                "field": "value"
              }
            }
          }
        }
      }
    }
  },
  "query": {
    "term": {
      "attribute": 68964466
    }
  }
}
```

---

<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:** [February 24, 2020, 2:27pm UTC](https://discuss.elastic.co/t/too-many-buckets-exception/216671/2 "2020-02-24T14:27:20Z")

</div>

Closed on February 24, 2020, 2:27pm UTC

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