# How to update index template

**URL:** <https://discuss.elastic.co/t/how-to-update-index-template/251491>\
**Category:** Elasticsearch\
**Created:** [October 8, 2020, 5:26pm UTC](https://discuss.elastic.co/t/how-to-update-index-template/251491 "2020-10-08T17:26:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Petr.Simik](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/petr.simik/32/38082_2.png) [@Petr.Simik](https://discuss.elastic.co/u/Petr.Simik)\
**Post date:** [October 8, 2020, 5:26pm UTC](https://discuss.elastic.co/t/how-to-update-index-template/251491/1 "2020-10-08T17:26:05Z")

</div>

Our cluster have about 170 index templates.  
I need to update all templates , include the settings:

```auto
PUT _template/testovaci
{
  "settings": {
    "index.routing.allocation.include.data": "hot"
  }
}

```

but this syntax does not work  
I have to use this type of syntax but this completely recreates the template and removes all mappings etc..

```auto
PUT _template/testovaci
{
  "index_patterns" : [
      "testovaci*"
    ],
  "settings": {
    "index.routing.allocation.include.data": "hot"
  }
}

```

Could you please help me to find the way how to update the mapping of all index templates?

---

<div class="post-metadata">

**Author:** ![elasticforme](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elasticforme](https://discuss.elastic.co/u/elasticforme)\
**Post date:** [October 8, 2020, 7:10pm UTC](https://discuss.elastic.co/t/how-to-update-index-template/251491/2 "2020-10-08T19:10:39Z")

</div>

I think you trying to put some setting so all index will go to hot storage correct?

if so you can do this.

```
PUT */_settings
{
  "index.routing.allocation.require.box_type": "hot"
}

```

ofcouse you can test it by following just one index.

```
PUT <inde_name>/_settings
{
  "index.routing.allocation.require.box_type": "hot"
}

```

you can get the result for confirmation

`GET */_settings?include_defaults=true&filter_path= **.routing.** `

---

<div class="post-metadata">

**Author:** ![Petr.Simik](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/petr.simik/32/38082_2.png) [@Petr.Simik](https://discuss.elastic.co/u/Petr.Simik)\
**Post date:** [October 9, 2020, 3:22am UTC](https://discuss.elastic.co/t/how-to-update-index-template/251491/3 "2020-10-09T03:22:45Z")

</div>

@elasticforme  
thank you I know this works on indices but it does not work on index templates.  
This approach works on existing indices only, but newly created indexes follows settings in its index\_templates and this I want to modify.

I tried to create default template on index pattern [\*] with low prio but the templates with higher priority replaces it . So it seems I will have to download all index\_templates update the settings and upload them back.

---

<div class="post-metadata">

**Author:** ![elasticforme](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elasticforme](https://discuss.elastic.co/u/elasticforme)\
**Post date:** [October 9, 2020, 6:11pm UTC](https://discuss.elastic.co/t/how-to-update-index-template/251491/4 "2020-10-09T18:11:32Z")

</div>

then you have to create a template and attach

now all new index\_pattern will have this template

PUT \_template/hot\_storage  
{  
"index\_patterns": "\*",  
"settings" : {  
"index.routing.allocation.require.box\_type": "hot"  
}  
}

---

<div class="post-metadata">

**Author:** ![Petr.Simik](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/petr.simik/32/38082_2.png) [@Petr.Simik](https://discuss.elastic.co/u/Petr.Simik)\
**Post date:** [October 10, 2020, 4:54pm UTC](https://discuss.elastic.co/t/how-to-update-index-template/251491/5 "2020-10-10T16:54:43Z")

</div>

@elasticforme  
yes you are right  
I forgot I can use multiple templates on index.

1. default templates matching all indices [\*] and giving them hot settings
2. specific template for each index [index\_name] and provide specific settings

I forgot this works,  
thank you

---

<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:** [November 7, 2020, 4:54pm UTC](https://discuss.elastic.co/t/how-to-update-index-template/251491/6 "2020-11-07T16:54:58Z")

</div>

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