# Update mappings on fly

**URL:** <https://discuss.elastic.co/t/update-mappings-on-fly/150320>\
**Category:** Elasticsearch\
**Created:** [September 28, 2018, 10:28am UTC](https://discuss.elastic.co/t/update-mappings-on-fly/150320 "2018-09-28T10:28:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![thitami](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thitami/32/32205_2.png) [@thitami](https://discuss.elastic.co/u/thitami)\
**Post date:** [September 28, 2018, 10:28am UTC](https://discuss.elastic.co/t/update-mappings-on-fly/150320/1 "2018-09-28T10:28:31Z")

</div>

We have experienced recently an issue when we released to production because our ES mappings needed to update.

What's the normal process to update the mappings on fly (with zero downtime) on production?  
I'd like to see what most of the people do in those cases.

---

<div class="post-metadata">

**Author:** ![Bernt\_Rostad](https://avatars.discourse-cdn.com/v4/letter/b/3ab097/32.png) [@Bernt\_Rostad](https://discuss.elastic.co/u/Bernt_Rostad)\
**Post date:** [September 28, 2018, 11:07am UTC](https://discuss.elastic.co/t/update-mappings-on-fly/150320/2 "2018-09-28T11:07:29Z")

</div>

> [@thitami](#):
>
> What's the normal process to update the mappings on fly (with zero downtime) on production?

It depends on whether you need to change the mapping for historical data or just for future data.

For future data (stored in new indices) it's sufficient just to put the new Index mapping in the cluster.

If you need a new mapping also for the historical data you will have to [reindex](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html) the old data into new indices to get the new mapping. If you use [Index Aliases](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html), this is easy to do in production because users can then continue to query the old indices (through their aliases) until the new one is ready, then you just swap the alias and delete the old index. Just make sure to have enough disc space for the reindexing.

---

<div class="post-metadata">

**Author:** ![thitami](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thitami/32/32205_2.png) [@thitami](https://discuss.elastic.co/u/thitami)\
**Post date:** [September 28, 2018, 2:19pm UTC](https://discuss.elastic.co/t/update-mappings-on-fly/150320/3 "2018-09-28T14:19:47Z")

</div>

Thanks for the reply, @Bernt_Rostad!

In our specific usecase we wanted to set the type of a field from `text` to `datetime`, so we wanted to change it for historical data.

From what I can foresee most of the times we'll need to just update field types or add new fields, if that helps?

---

<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 26, 2018, 2:19pm UTC](https://discuss.elastic.co/t/update-mappings-on-fly/150320/4 "2018-10-26T14:19:50Z")

</div>

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