# Index template update overrides mapping

**URL:** https://discuss.elastic.co/t/index-template-update-overrides-mapping/197784
**Category:** Elasticsearch
**Created:** [September 3, 2019, 8:30am UTC](https://discuss.elastic.co/t/index-template-update-overrides-mapping/197784 "2019-09-03T08:30:53Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![somi](https://avatars.discourse-cdn.com/v4/letter/s/ac8455/32.png) [@somi](https://discuss.elastic.co/u/somi)
#### Post date: [September 3, 2019, 8:30am UTC](https://discuss.elastic.co/t/index-template-update-overrides-mapping/197784/1 "2019-09-03T08:30:53Z")

</div>

**Hello all,**

I am trying to update default apm index template's `settings` field by sending PUT request to the **\_template** endpoint. My problem is that the request overrides the `mappings` field as well, hence, I loose the default mappings. Even though, I've read in multiple discussions that it is possible to update an index template, I am not able to do it without loosing configurations.

**Is there anyone facing a similar problem?**

I am using Elasticsearch 7.3.

Here are my steps:

- apm-server creates an index template (will not copy here as it is quite long), here are the settings of apm:

```auto
setup.template.enabled: true
setup.template.fields: "${path.config}/fields.yml"
setup.template.overwrite: false
setup.template.name: 'apm-tmpl'
setup.template.pattern: 'apm-*'

```

- I applied the following 'update':

```auto
curl -X PUT "localhost:9200/_template/apm-tmpl?pretty" -H 'Content-Type: application/json' -d'
{
  "index_patterns": ["apm-*"],
  "settings": {
    "index.lifecycle.name": "custom",
    "index.number_of_replicas": 0
  }
}
'

```

- and finally here is the updated template (with empty mappings):

```auto
curl -X GET "localhost:9200/_template/apm-tmpl?pretty" -H 'Content-Type: application/json'

{
  "apm-tmpl" : {
    "order" : 0,
    "index_patterns" : [
      "apm-*"
    ],
    "settings" : {
      "index" : {
        "lifecycle" : {
          "name" : "custom"
         },
         number_of_replicas": 0
      }
    },
    "mappings" : { },
    "aliases" : { }
  }
}

```

---

<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: [October 1, 2019, 8:31am UTC](https://discuss.elastic.co/t/index-template-update-overrides-mapping/197784/2 "2019-10-01T08:31:47Z")

</div>

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