elastic/elasticsearch · error · UnsupportedOperationException

deprecated fields not supported in [{parserName}] but got [{

Error message

deprecated fields not supported in [{parserName}] but got [{oldName}] at [{location}] which has been replaced with [{currentName}]

What it means

THROW_UNSUPPORTED_OPERATION.logRenamedField throws when a field is supplied under a deprecated 'renamed' alias (same field, just an old name) and parserName is non-null. Distinct from 'replaced': renamed means the field still exists but its name changed; replaced means the field was swapped for a different field. location and parserName are included.

Source

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

                        + "] 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
                        + "]"
                );
            } else {
                throw new UnsupportedOperationException(
                    "deprecated fields not supported here but got [" + oldName + "] which has been replaced with [" + currentName + "]"
                );
            }
        }

        @Override

View on GitHub (pinned to db6a809a66)

Solutions

  1. Update the client/input to use currentName shown in the message.
  2. If backward compatibility is required during migration, use a DeprecationHandler that logs rather than throws.
  3. Once migration completes, remove the deprecated alias from the ParseField so the name is simply unknown (cleaner error) rather than deprecated.

Example fix

// before
{"ttl": 30}   // 'ttl' is a renamed alias -> 'expire_after'
// after
{"expire_after": 30}
Defensive patterns

Strategy: validation

Validate before calling

// rename deprecated field aliases to current names before strict parsing
Map<String,String> renamed = Map.of("ttl", "expire_after");
if (renamed.containsKey(bodyKey)) { body.put(renamed.get(bodyKey), body.remove(bodyKey)); }

Try / catch

try {
    p.parse(parser, ctx);
} catch (UnsupportedOperationException e) {
    if (e.getMessage().contains("which is a deprecated name for [")) {
        // extract currentName and retry
    }
}

Prevention

When it happens

Trigger: Strict parsing (THROW_UNSUPPORTED_OPERATION) of input using a deprecated alias for a field that was merely renamed, with a named parser. Encountered when a field rename shipped and old clients still send the prior name.

Common situations: Post-rename migration: clients on older SDKs sending the old field name to a handler that rejects deprecated names. CI assertions that legacy names are no longer accepted.

Related errors


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