# Following example to update mappings gives exception

**URL:** <https://discuss.elastic.co/t/following-example-to-update-mappings-gives-exception/319155>\
**Category:** Kibana\
**Created:** [November 17, 2022, 9:35am UTC](https://discuss.elastic.co/t/following-example-to-update-mappings-gives-exception/319155 "2022-11-17T09:35:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tinrik](https://avatars.discourse-cdn.com/v4/letter/t/d78d45/32.png) [@tinrik](https://discuss.elastic.co/u/tinrik)\
**Post date:** [November 17, 2022, 9:35am UTC](https://discuss.elastic.co/t/following-example-to-update-mappings-gives-exception/319155/1 "2022-11-17T09:35:20Z")

</div>

Hi,

I'm following [this example](https://www.elastic.co/guide/en/elasticsearch/reference/current/tune-for-disk-usage.html#default-dynamic-string-mapping) to bring down the storage usage of my index.

However when I try it out:

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

```

I get:

```auto
{
  "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?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [November 17, 2022, 9:50am UTC](https://discuss.elastic.co/t/following-example-to-update-mappings-gives-exception/319155/2 "2022-11-17T09:50:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 15, 2022, 9:51am UTC](https://discuss.elastic.co/t/following-example-to-update-mappings-gives-exception/319155/3 "2022-12-15T09:51:08Z")

</div>

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