{"record":{"id":"a6992cc2e40cb6c9","repo":"elastic/elasticsearch","slug":"deprecated-fields-not-supported-in-parsername-a6992c","errorCode":null,"errorMessage":"deprecated fields not supported in [{parserName}] but got [{oldName}] at [{location}] which has been replaced with [{currentName}]","messagePattern":"deprecated fields not supported in \\[(.+?)\\] but got \\[(.+?)\\] at \\[(.+?)\\] which has been replaced with \\[(.+?)\\]","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"libs/x-content/src/main/java/org/elasticsearch/xcontent/DeprecationHandler.java","lineNumber":50,"sourceCode":"                        + \"] but got [\"\n                        + oldName\n                        + \"] at [\"\n                        + location.get()\n                        + \"] which is a deprecated name for [\"\n                        + replacedName\n                        + \"]\"\n                );\n            } else {\n                throw new UnsupportedOperationException(\n                    \"deprecated fields not supported here but got [\" + oldName + \"] which is a deprecated name for [\" + replacedName + \"]\"\n                );\n            }\n        }\n\n        @Override\n        public void logRenamedField(String parserName, Supplier<XContentLocation> location, String oldName, String currentName) {\n            if (parserName != null) {\n                throw new UnsupportedOperationException(\n                    \"deprecated fields not supported in [\"\n                        + parserName\n                        + \"] but got [\"\n                        + oldName\n                        + \"] at [\"\n                        + location.get()\n                        + \"] which has been replaced with [\"\n                        + currentName\n                        + \"]\"\n                );\n            } else {\n                throw new UnsupportedOperationException(\n                    \"deprecated fields not supported here but got [\" + oldName + \"] which has been replaced with [\" + currentName + \"]\"\n                );\n            }\n        }\n\n        @Override","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/libs/x-content/src/main/java/org/elasticsearch/xcontent/DeprecationHandler.java#L32-L68","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Update the client/input to use currentName shown in the message.","If backward compatibility is required during migration, use a DeprecationHandler that logs rather than throws.","Once migration completes, remove the deprecated alias from the ParseField so the name is simply unknown (cleaner error) rather than deprecated."],"exampleFix":"// before\n{\"ttl\": 30}   // 'ttl' is a renamed alias -> 'expire_after'\n// after\n{\"expire_after\": 30}","handlingStrategy":"validation","validationCode":"// rename deprecated field aliases to current names before strict parsing\nMap<String,String> renamed = Map.of(\"ttl\", \"expire_after\");\nif (renamed.containsKey(bodyKey)) { body.put(renamed.get(bodyKey), body.remove(bodyKey)); }","typeGuard":null,"tryCatchPattern":"try {\n    p.parse(parser, ctx);\n} catch (UnsupportedOperationException e) {\n    if (e.getMessage().contains(\"which is a deprecated name for [\")) {\n        // extract currentName and retry\n    }\n}","preventionTips":["Keep a version-aware alias map and translate client input to current names before strict parsing.","During a rename rollout, prefer a logging deprecation handler until clients migrate.","Remove deprecated aliases from ParseField once the migration period ends."],"tags":["xcontent","deprecation","strict","field-rename"],"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T06:17:24.410Z"}