**Build scan:**
https://gradle-enterprise.elastic.co/s/xl4uqehihgkxs/tests/:x-pack:plugin:rollup:test/org.elasticsearch.xpack.rollup.v2.RollupActionSingleNodeTests/testRollupDatastream

**Reproduction line:**
`./gradlew ':x-pack:plugin:rollup:test' --tests "org.elasticsearch.xpack.rollup.v2.RollupActionSingleNodeTests.testRollupDatastream" -Dtests.seed=4E779F8B2A344C56 -Dtests.locale=sl -Dtests.timezone=NST -Druntime.java=18`

**Applicable branches:**
main

**Reproduces locally?:**
No

**Failure history:**
https://gradle-enterprise.elastic.co/scans/tests?tests.container=org.elasticsearch.xpack.rollup.v2.RollupActionSingleNodeTests&tests.test=testRollupDatastream

**Failure excerpt:**
```
org.elasticsearch.action.search.SearchPhaseExecutionException: 
  at __randomizedtesting.SeedInfo.seed([4E779F8B2A344C56:84AC3906E3AE0A19]:0)
  at org.elasticsearch.action.search.AbstractSearchAsyncAction.onPhaseFailure(AbstractSearchAsyncAction.java:728)
  at org.elasticsearch.action.search.FetchSearchPhase$1.onFailure(FetchSearchPhase.java:95)
  at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:28)
  at org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:33)
  at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:769)
  at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
  at java.lang.Thread.run(Thread.java:833)

  Caused by: org.elasticsearch.search.aggregations.MultiBucketConsumerService$TooManyBucketsException: Trying to create too many buckets. Must be less than or equal to: [65536] but this number of buckets was exceeded. This limit can be set by changing the [search.max_buckets] cluster level setting.

    at org.elasticsearch.search.aggregations.MultiBucketConsumerService$MultiBucketConsumer.accept(MultiBucketConsumerService.java:115)
    at org.elasticsearch.search.aggregations.AggregationReduceContext$ForFinal.consumeBucketCountAndMaybeBreak(AggregationReduceContext.java:213)
    at org.elasticsearch.search.aggregations.AggregationReduceContext.consumeBucketsAndMaybeBreak(AggregationReduceContext.java:119)
    at org.elasticsearch.search.aggregations.bucket.histogram.InternalDateHistogram.addEmptyBuckets(InternalDateHistogram.java:407)
    at org.elasticsearch.search.aggregations.bucket.histogram.InternalDateHistogram.reduce(InternalDateHistogram.java:476)
    at org.elasticsearch.search.aggregations.InternalAggregations.reduce(InternalAggregations.java:159)
    at org.elasticsearch.search.aggregations.bucket.terms.AbstractInternalTerms.reduceBucket(AbstractInternalTerms.java:109)
    at org.elasticsearch.search.aggregations.DelayedBucket.reduced(DelayedBucket.java:59)
    at org.elasticsearch.search.aggregations.TopBucketBuilder$BufferingTopBucketBuilder.build(TopBucketBuilder.java:180)
    at org.elasticsearch.search.aggregations.bucket.terms.AbstractInternalTerms.reduce(AbstractInternalTerms.java:315)
    at org.elasticsearch.search.aggregations.InternalAggregations.reduce(InternalAggregations.java:159)
    at org.elasticsearch.search.aggregations.InternalAggregations.topLevelReduce(InternalAggregations.java:106)
    at org.elasticsearch.action.search.SearchPhaseController.reduceAggs(SearchPhaseController.java:601)
    at org.elasticsearch.action.search.SearchPhaseController.reducedQueryPhase(SearchPhaseController.java:570)
    at org.elasticsearch.action.search.QueryPhaseResultConsumer.reduce(QueryPhaseResultConsumer.java:130)
    at org.elasticsearch.action.search.FetchSearchPhase.innerRun(FetchSearchPhase.java:104)
    at org.elasticsearch.action.search.FetchSearchPhase$1.doRun(FetchSearchPhase.java:90)
    at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
    at org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:33)
    at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:769)
    at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.lang.Thread.run(Thread.java:833)

```
x-pack/plugin/rollup/src/test/java/org/elasticsearch/xpack/rollup/v2/RollupActionSingleNodeTests.java
/*
 * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
 * or more contributor license agreements. Licensed under the Elastic License
 * 2.0; you may not use this file except in compliance with the Elastic License
 * 2.0.
 */
package org.elasticsearch.xpack.rollup.v2;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.ResourceAlreadyExistsException;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.ActionRequestValidationException;