elastic/elasticsearch · error · IllegalArgumentException

Number of field values do not match number of field names.

Error message

Number of field values do not match number of field names.

What it means

Error "Number of field values do not match number of field names." thrown in elastic/elasticsearch.

Source

Thrown at modules/aggregations/src/main/java/org/elasticsearch/aggregations/metric/RunningStats.java:130

        out.writeGenericValue(means);
        // variances
        out.writeGenericValue(variances);
        // skewness
        out.writeGenericValue(skewness);
        // kurtosis
        out.writeGenericValue(kurtosis);
        // covariances
        out.writeGenericValue(covariances);
    }

    /** updates running statistics with a documents field values **/
    public void add(final String[] fieldNames, final double[] fieldVals) {
        if (fieldNames == null) {
            throw new IllegalArgumentException("Cannot add statistics without field names.");
        } else if (fieldVals == null) {
            throw new IllegalArgumentException("Cannot add statistics without field values.");
        } else if (fieldNames.length != fieldVals.length) {
            throw new IllegalArgumentException("Number of field values do not match number of field names.");
        }

        // update total, mean, and variance
        ++docCount;
        String fieldName;
        double fieldValue;
        double m1, m2, m3, m4;  // moments
        double d, dn, dn2, t1;
        final HashMap<String, Double> deltas = new HashMap<>();
        for (int i = 0; i < fieldNames.length; ++i) {
            fieldName = fieldNames[i];
            fieldValue = fieldVals[i];

            // update counts
            counts.put(fieldName, 1 + (counts.containsKey(fieldName) ? counts.get(fieldName) : 0));
            // update running sum
            fieldSum.put(fieldName, fieldValue + (fieldSum.containsKey(fieldName) ? fieldSum.get(fieldName) : 0));
            // update running deltas

View on GitHub (pinned to db6a809a66)

When it happens

Trigger: Thrown at modules/aggregations/src/main/java/org/elasticsearch/aggregations/metric/RunningStats.java:130 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/4bbb2a0b27c4d51d. Report an issue: GitHub.