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:
 
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':
 
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):
 
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" : { }
  }
}