elastic/elasticsearch · error · IllegalArgumentException

Aggregation [{getName()}] all fields must exist in all indic

Error message

Aggregation [{getName()}] all fields must exist in all indices, but some indices are missing these fields [{fields}]

What it means

Error "Aggregation [{getName()}] all fields must exist in all indices, but some indices are missing these fields [{fields}]" thrown in elastic/elasticsearch.

Source

Thrown at modules/aggregations/src/main/java/org/elasticsearch/aggregations/metric/InternalMatrixStats.java:252

            throw new IllegalArgumentException("path not supported for [" + getName() + "]: " + path);
        }
    }

    @Override
    protected AggregatorReducer getLeaderReducer(AggregationReduceContext reduceContext, int size) {
        return new AggregatorReducer() {
            private RunningStats runningStats;

            @Override
            public void accept(InternalAggregation aggregation) {
                final InternalMatrixStats internalMatrixStats = (InternalMatrixStats) aggregation;
                if (internalMatrixStats.stats != null) {
                    if (runningStats == null) {
                        runningStats = new RunningStats();
                    }
                    final Set<String> missingFields = runningStats.missingFieldNames(internalMatrixStats.stats);
                    if (missingFields.isEmpty() == false) {
                        throw new IllegalArgumentException(
                            "Aggregation ["
                                + internalMatrixStats.getName()
                                + "] all fields must exist in all indices, but some indices are missing these fields ["
                                + String.join(", ", new TreeSet<>(missingFields))
                                + "]"
                        );
                    }
                    runningStats.merge(internalMatrixStats.stats);
                }
            }

            @Override
            public InternalAggregation get() {
                // return empty result iff all stats are null
                if (runningStats == null) {
                    return new InternalMatrixStats(name, 0, null, new MatrixStatsResults(), getMetadata());
                }
                if (reduceContext.isFinalReduce()) {

View on GitHub (pinned to db6a809a66)

When it happens

Trigger: Thrown at modules/aggregations/src/main/java/org/elasticsearch/aggregations/metric/InternalMatrixStats.java:252 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12). Data as JSON: /api/errors/a1496f52b4df16d7. Report an issue: GitHub.