elastic/elasticsearch · error · UnsupportedOperationException

deprecated fields not supported here but got [{oldName}] whi

Error message

deprecated fields not supported here but got [{oldName}] which is a deprecated name for [{replacedName}]

What it means

Same THROW_UNSUPPORTED_OPERATION.logReplacedField path as 867, but parserName is null so the message omits the parser context. This variant surfaces when the parser was created without a parserName but still configured to throw on deprecated fields. The deprecated alias maps to a replacement field name.

Source

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

     * to fail fast when parsing deprecated fields.
     */
    DeprecationHandler THROW_UNSUPPORTED_OPERATION = new DeprecationHandler() {
        @Override
        public void logReplacedField(String parserName, Supplier<XContentLocation> location, String oldName, String replacedName) {
            if (parserName != null) {
                throw new UnsupportedOperationException(
                    "deprecated fields not supported in ["
                        + parserName
                        + "] but got ["
                        + oldName
                        + "] at ["
                        + location.get()
                        + "] which is a deprecated name for ["
                        + replacedName
                        + "]"
                );
            } else {
                throw new UnsupportedOperationException(
                    "deprecated fields not supported here but got [" + oldName + "] which is a deprecated name for [" + replacedName + "]"
                );
            }
        }

        @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
                        + "]"

View on GitHub (pinned to db6a809a66)

Solutions

  1. Switch the deprecated alias to its replacement name shown in the message.
  2. Pass a parserName when creating the parser so future errors carry more context, and/or switch to a lenient deprecation handler if legacy names are acceptable.
  3. Register the alias as non-deprecated if it is now a first-class supported name.
Defensive patterns

Strategy: validation

Validate before calling

// provide a parserName so this variant doesn't occur, and rename deprecated aliases
// e.g. ensure body uses the replacement field before parsing

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 replacement and retry
    }
}

Prevention

When it happens

Trigger: Parsing with THROW_UNSUPPORTED_OPERATION on a parser whose parserName is null (e.g. ad-hoc parser created without a name), and the input contains a deprecated 'replaced' field alias.

Common situations: Unit tests or one-off parsers created without naming the parser. Shared utility parsers reused across contexts without a parserName.

Related errors


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