elastic/elasticsearch · error · IllegalArgumentException
minimum_interval must be one of [{ALLOWED_INTERVALS.values()
Error message
minimum_interval must be one of [{ALLOWED_INTERVALS.values()}] What it means
Thrown by AutoDateHistogramAggregationBuilder.setMinimumIntervalExpression when the supplied value is non-null but not one of the allowed intervals. Allowed values are the strings in ALLOWED_INTERVALS: year, month, day, hour, minute, second. The minimum_interval caps the granularity the auto-calculator is allowed to use.
Source
Thrown at modules/aggregations/src/main/java/org/elasticsearch/aggregations/bucket/histogram/AutoDateHistogramAggregationBuilder.java:171
}
@Override
protected AggregationBuilder shallowCopy(Builder factoriesBuilder, Map<String, Object> metadata) {
return new AutoDateHistogramAggregationBuilder(this, factoriesBuilder, metadata);
}
@Override
public String getType() {
return NAME;
}
public String getMinimumIntervalExpression() {
return minimumIntervalExpression;
}
public AutoDateHistogramAggregationBuilder setMinimumIntervalExpression(String minimumIntervalExpression) {
if (minimumIntervalExpression != null && ALLOWED_INTERVALS.containsValue(minimumIntervalExpression) == false) {
throw new IllegalArgumentException(
MINIMUM_INTERVAL_FIELD.getPreferredName() + " must be one of [" + ALLOWED_INTERVALS.values() + "]"
);
}
this.minimumIntervalExpression = minimumIntervalExpression;
return this;
}
public AutoDateHistogramAggregationBuilder setNumBuckets(int numBuckets) {
if (numBuckets <= 0) {
throw new IllegalArgumentException(NUM_BUCKETS_FIELD.getPreferredName() + " must be greater than 0 for [" + name + "]");
}
this.numBuckets = numBuckets;
return this;
}
@Override
public BucketCardinality bucketCardinality() {
return BucketCardinality.MANY;View on GitHub (pinned to db6a809a66)
Solutions
- Use one of the six allowed values: year, month, day, hour, minute, second.
- Omit minimum_interval entirely if you want the aggregation to auto-select any granularity.
- Validate the value client-side against the allowed set before submitting.
Example fix
// before
{"auto_date_histogram":{"field":"@timestamp","minimum_interval":"week"}}
// after
{"auto_date_histogram":{"field":"@timestamp","minimum_interval":"day"}} Defensive patterns
Strategy: validation
Validate before calling
Set<String> ALLOWED = Set.of("year","month","day","hour","minute","second");
if (minimumInterval != null && !ALLOWED.contains(minimumInterval)) {
throw new IllegalArgumentException("minimum_interval must be one of " + ALLOWED);
} Type guard
boolean isValidMinimumInterval(String s) {
return s == null || Set.of("year","month","day","hour","minute","second").contains(s);
} Prevention
- Remember auto_date_histogram supports only 6 intervals (no week/quarter).
- Validate against the allowed set before submitting.
- Omit minimum_interval to let the aggregation auto-select.
When it happens
Trigger: Calling `setMinimumIntervalExpression("week")`, `"quarter"`, `"millisecond"`, or any typo. Submitting a REST request with `"minimum_interval": "weeks"` (plural or wrong unit).
Common situations: Users assuming the auto_date_histogram supports the same intervals as the regular date_histogram (which allows more units like week, quarter, fiscal periods). Pluralization typos. Copy-paste from date_histogram configurations.
Related errors
- buckets must be greater than 0 for [{name}]
- [${name}] is missing : filters parameter
- [separator] must not be null: [${name}]
- [key] must not be null
- [filter] must not be null
AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12).
Data as JSON: /api/errors/b70b3a1836bd3677.
Report an issue: GitHub.