elastic/elasticsearch · error · ParsingException

Unexpected token {token} [{currentFieldName}] in [{aggregati

Error message

Unexpected token {token} [{currentFieldName}] in [{aggregationName}]. Multi-field aggregations do not support scripts.

What it means

Error "Unexpected token {token} [{currentFieldName}] in [{aggregationName}]. Multi-field aggregations do not support scripts." thrown in elastic/elasticsearch.

Source

Thrown at modules/aggregations/src/main/java/org/elasticsearch/aggregations/metric/ArrayValuesSourceParser.java:79

    @Override
    public final ArrayValuesSourceAggregationBuilder<?> parse(String aggregationName, XContentParser parser) throws IOException {

        List<String> fields = null;
        String format = null;
        Map<String, Object> missingMap = null;
        Map<ParseField, Object> otherOptions = new HashMap<>();
        XContentParser.Token token;
        String currentFieldName = null;
        while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
            if (token == XContentParser.Token.FIELD_NAME) {
                currentFieldName = parser.currentName();
            } else if (token == XContentParser.Token.VALUE_STRING) {
                if (CommonFields.FIELDS.match(currentFieldName, parser.getDeprecationHandler())) {
                    fields = Collections.singletonList(parser.text());
                } else if (formattable && CommonFields.FORMAT.match(currentFieldName, parser.getDeprecationHandler())) {
                    format = parser.text();
                } else if (CommonFields.VALUE_TYPE.match(currentFieldName, parser.getDeprecationHandler())) {
                    throw new ParsingException(
                        parser.getTokenLocation(),
                        "Unexpected token "
                            + token
                            + " ["
                            + currentFieldName
                            + "] in ["
                            + aggregationName
                            + "]. "
                            + "Multi-field aggregations do not support scripts."
                    );
                } else if (token(aggregationName, currentFieldName, token, parser, otherOptions) == false) {
                    throw new ParsingException(
                        parser.getTokenLocation(),
                        "Unexpected token " + token + " [" + currentFieldName + "] in [" + aggregationName + "]."
                    );
                }
            } else if (token == XContentParser.Token.START_OBJECT) {
                if (CommonFields.MISSING.match(currentFieldName, parser.getDeprecationHandler())) {

View on GitHub (pinned to db6a809a66)

When it happens

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

Common situations: See trigger scenarios.

Understand the failure class


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