Following example to update mappings gives exception

Hi,

I'm following this example to bring down the storage usage of my index.

However when I try it out:

PUT /my_index/_mapping
{
  "mappings": {
    "dynamic_templates": [
      {
        "strings": {
          "match_mapping_type": "string",
          "mapping": {
            "type": "keyword"
          }
        }
      }
    ]
  }
}

I get:

{
  "error" : {
    "root_cause" : [
      {
        "type" : "mapper_parsing_exception",
        "reason" : "Root mapping definition has unsupported parameters:  [mappings : {dynamic_templates=[{strings={mapping={type=keyword}, match_mapping_type=string}}]}]"
      }
    ],
    "type" : "mapper_parsing_exception",
    "reason" : "Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters:  [mappings : {dynamic_templates=[{strings={mapping={type=keyword}, match_mapping_type=string}}]}]",
    "caused_by" : {
      "type" : "mapper_parsing_exception",
      "reason" : "Root mapping definition has unsupported parameters:  [mappings : {dynamic_templates=[{strings={mapping={type=keyword}, match_mapping_type=string}}]}]"
    }
  },
  "status" : 400
}

What am I doing wrong?

You cannot update an existing mapping, so you need to create a new index with this and then reindex the old data into it.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.