Error log: You’ll see this error when trying to create an index or an index template, and your _mappings structure is wrong at the very top level.
JSON
None
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "Root mapping definition has unsupported parameters:
[my_index_type] [properties] [...]"
}
],
"type": "mapper_parsing_exception",
"reason": "Root mapping definition has unsupported parameters:
[my_index_type] [properties] [...]"
},
"status": 400
}
Or a common variation:
None
"reason": "Mapping definition for [_doc] has unsupported parameters: [enabled]"
Why… is this happening? This is a syntax error in your mapping definition, but it’s a specific one. It means you’ve put keys at the top level of your mapping that don’t belong there.
Historical context: In very old versions (Elasticsearch 6.x and earlier), indices had “mapping types” (like _doc or a custom name like my_index_type). The mapping structure looked like this: {"mappings": {"my_index_type": {"properties": {...}}}}.
This is no longer supported. Mapping types have been removed.
The correct, modern mapping structure has properties as the direct child of mappings.
- Old / Broken:
{"mappings": {"my_index_type": {"properties": {...}}}} - New / Correct:
{"mappings": {"properties": {...}}}
You are getting this error because your mapping definition is structured the old way. You might also get it if you add other invalid top-level keys like enabled (which belongs under a specific field, not at the root).
Best practice:
1. Remove mapping types: This is the #1 fix. If you are migrating from an old version or copying an old example, delete the mapping type layer from your JSON.
- Before (Broken): JSON
None { "mappings": { "_doc": { "properties": { "my_field": { "type": "keyword" } } } } }- After (Fixed): JSON
None { "mappings": { "properties": { "my_field": { "type": "keyword" } } } }
2. Check for other invalid eys: The error message will list all invalid keys. properties, _meta, dynamic, and runtime are some of the only valid top-level keys inside mappings. Move any other keys (like enabled or dynamic_templates) to their correct locations.
What else can I do? Confused about mappings after a migration? You’re not alone. The “Removal of Mapping Types” is a major change. Check the OpenSearch documentation for the correct _mappings structure, or post your old mapping on the community forums for help converting it. You can also contact us in The OpenSearch Slack Channel in #General.