# Applying updates to mappings using templates

**URL:** <https://discuss.elastic.co/t/applying-updates-to-mappings-using-templates/16842>\
**Category:** Elasticsearch\
**Created:** [April 7, 2014, 1:26pm UTC](https://discuss.elastic.co/t/applying-updates-to-mappings-using-templates/16842 "2014-04-07T13:26:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jed\_Glazner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jed_glazner/32/1661_2.png) [@Jed\_Glazner](https://discuss.elastic.co/u/Jed_Glazner)\
**Post date:** [April 7, 2014, 1:26pm UTC](https://discuss.elastic.co/t/applying-updates-to-mappings-using-templates/16842/1 "2014-04-07T13:26:49Z")

</div>

Hey Guys,

So I'm working on a project where we are planning on creating several  
indexes that all have several fields in common. We are not sure how many  
indexes we will need but they will always 'extend' this base  
schema/mapping. I thought we could use the template feature, but as I  
discovered the templates are only read during index creation and indexes  
that are based on this template do not know about the schema changes. I  
don't want to manually get/modify/post mapping updates for dozens of schema  
any type we add a new field (very likely to happen).

My question then is would it be useful to anyone else to have a feature for  
automatically updating existing indexes based on the template when changes  
to that template are made?

something like:

curl -XPUT [http://localhost:9200/](http://localhost:9200/)_templates/my\_template  
{  
"template": "my_\*",

- "update\_index\_mappings":true,\*  
"mappings": {  
...  
}  
}

Or where when updating a mapping specify a template to use?

curl -XPOST [http://localhost:9200/my\_index/\_mapping](http://localhost:9200/my_index/_mapping)  
{

- "template" : "my\_template",\*  
"mappings": {  
...  
}  
}

Or if there already exists a way of doing this please let me know.

Thanks!

Jed

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/bf02563f-49cf-4603-8743-c03116e9ba41%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/bf02563f-49cf-4603-8743-c03116e9ba41%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Binh\_Ly\_2](https://avatars.discourse-cdn.com/v4/letter/b/d07c76/32.png) [@Binh\_Ly\_2](https://discuss.elastic.co/u/Binh_Ly_2)\
**Post date:** [April 9, 2014, 2:31pm UTC](https://discuss.elastic.co/t/applying-updates-to-mappings-using-templates/16842/2 "2014-04-09T14:31:29Z")

</div>

FWIW, you can update mappings for multiple indexes if necessary:

curl -XPUT localhost:9200/a,b,c/type/\_mapping

or

curl -XPUT localhost:9200/\_all/type/\_mapping

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/6cb5a3f7-b86f-4b58-9efc-b1f6a8096bb8%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6cb5a3f7-b86f-4b58-9efc-b1f6a8096bb8%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [July 6, 2017, 1:37am UTC](https://discuss.elastic.co/t/applying-updates-to-mappings-using-templates/16842/3 "2017-07-06T01:37:15Z")

</div>


