elastic/elasticsearch · error · UnsupportedOperationException

deprecated fields not supported here but got

Error message

deprecated fields not supported here but got [{oldName}] which has been replaced with [{currentName}]

What it means

logRenamedField, parserName-null variant: a deprecated renamed field alias is encountered under THROW_UNSUPPORTED_OPERATION but the parser has no parserName, so the message drops the parser context. Same semantics as 869 regarding renamed (not replaced) fields.

Solutions

  1. Send the current field name (currentName in the message).
  2. Supply a parserName to improve diagnostics and/or relax the deprecation handler if legacy names must pass.
Defensive patterns

Strategy: validation

Validate before calling

// supply a parserName and rename deprecated aliases to current names pre-parse

Try / catch

try {
    p.parse(parser, ctx);
} catch (UnsupportedOperationException e) {
    if (e.getMessage().startsWith("deprecated fields not supported here") && e.getMessage().contains("deprecated name for [")) {
        // rename to currentName and retry
    }
}

Prevention

When it happens

Trigger: Strict deprecated-field rejection on an unnamed parser where input uses an old field name that was renamed. Typical of unnamed/ad-hoc parsers in tests or internal utilities.

Common situations: Unnamed parsers in shared library code. Test parsers created without parserName that nonetheless enforce deprecation strictly.

Related errors


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

Appendix: source

Thrown at libs/x-content/src/main/java/org/elasticsearch/xcontent/DeprecationHandler.java:62

            }
        }

        @Override
        public void logRenamedField(String parserName, Supplier<XContentLocation> location, String oldName, String currentName) {
            if (parserName != null) {
                throw new UnsupportedOperationException(
                    "deprecated fields not supported in ["
                        + parserName
                        + "] but got ["
                        + oldName
                        + "] at ["
                        + location.get()
                        + "] which has been replaced with ["
                        + currentName
                        + "]"
                );
            } else {
                throw new UnsupportedOperationException(
                    "deprecated fields not supported here but got [" + oldName + "] which has been replaced with [" + currentName + "]"
                );
            }
        }

        @Override
        public void logRemovedField(String parserName, Supplier<XContentLocation> location, String removedName) {
            if (parserName != null) {
                throw new UnsupportedOperationException(
                    "deprecated fields not supported in ["
                        + parserName
                        + "] but got ["
                        + removedName
                        + "] at ["
                        + location.get()
                        + "] which has been deprecated entirely"
                );
            } else {

View on GitHub (pinned to db6a809a66)