# What happens to data in an existing type if we update the mapping to specify 'path's for \_id and \_routing

**URL:** <https://discuss.elastic.co/t/what-happens-to-data-in-an-existing-type-if-we-update-the-mapping-to-specify-paths-for--id-and--routing/20444>\
**Category:** Elasticsearch\
**Created:** [October 27, 2014, 9:33am UTC](https://discuss.elastic.co/t/what-happens-to-data-in-an-existing-type-if-we-update-the-mapping-to-specify-paths-for--id-and--routing/20444 "2014-10-27T09:33:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Preeti\_Raj\_Buchhada](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/preeti_raj_buchhada/32/8971_2.png) [@Preeti\_Raj\_Buchhada](https://discuss.elastic.co/u/Preeti_Raj_Buchhada)\
**Post date:** [October 27, 2014, 9:33am UTC](https://discuss.elastic.co/t/what-happens-to-data-in-an-existing-type-if-we-update-the-mapping-to-specify-paths-for--id-and--routing/20444/1 "2014-10-27T09:33:16Z")

</div>

We are using ES 1.3.2.  
We have a need to specify custom id and routing values when indexing.  
We've been doing this using Java APIs, however we would now like to update  
the mapping to specify 'path's for \_id and \_routing.

The question we have is:

1. Since this type already has a huge number of documents, can we change  
the mapping? When we tried it, we got a '"acknowledged": true' response,  
but it doesn't seem to be working when we tried indexing.
2. In case there is a way to achieve this, will it affect only the new  
documents being indexed?

--  
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/1c5516bd-7738-4969-8bee-b979aa89b65b%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/1c5516bd-7738-4969-8bee-b979aa89b65b%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Preeti\_Raj\_Buchhada](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/preeti_raj_buchhada/32/8971_2.png) [@Preeti\_Raj\_Buchhada](https://discuss.elastic.co/u/Preeti_Raj_Buchhada)\
**Post date:** [October 28, 2014, 7:13am UTC](https://discuss.elastic.co/t/what-happens-to-data-in-an-existing-type-if-we-update-the-mapping-to-specify-paths-for--id-and--routing/20444/2 "2014-10-28T07:13:00Z")

</div>

Any ideas on this?

On Monday, October 27, 2014 3:03:16 PM UTC+5:30, Preeti Raj - Buchhada  
wrote:

> We are using ES 1.3.2.  
> We have a need to specify custom id and routing values when indexing.  
> We've been doing this using Java APIs, however we would now like to update  
> the mapping to specify 'path's for \_id and \_routing.
> 
> The question we have is:
> 
> 1. Since this type already has a huge number of documents, can we change  
> the mapping? When we tried it, we got a '"acknowledged": true' response,  
> but it doesn't seem to be working when we tried indexing.
> 2. In case there is a way to achieve this, will it affect only the new  
> documents being indexed?

--  
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/1b912d68-900f-4f6f-be5f-cbae83776e1b%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/1b912d68-900f-4f6f-be5f-cbae83776e1b%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 28, 2014, 7:21am UTC](https://discuss.elastic.co/t/what-happens-to-data-in-an-existing-type-if-we-update-the-mapping-to-specify-paths-for--id-and--routing/20444/3 "2014-10-28T07:21:02Z")

</div>

You can update a mapping (adding new fields or new sub fields)  
Old documents won't be updated.

A common best practice is to reindex your data.

About specific fields like \_routing and \_id, I think that updating the mapping for them won't work so it will require to reindex.  
Never tested it though.

--  
David Pilato | Technical Advocate | [elasticsearch.com](http://elasticsearch.com)  
[david.pilato@elasticsearch.com](mailto:david.pilato@elasticsearch.com)  
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 28 octobre 2014 à 08:13:04, Preeti Raj - Buchhada ([pbuchhada@gmail.com](mailto:pbuchhada@gmail.com)) a écrit:

Any ideas on this?

On Monday, October 27, 2014 3:03:16 PM UTC+5:30, Preeti Raj - Buchhada wrote:  
We are using ES 1.3.2.  
We have a need to specify custom id and routing values when indexing.  
We've been doing this using Java APIs, however we would now like to update the mapping to specify 'path's for \_id and \_routing.

The question we have is:

1. Since this type already has a huge number of documents, can we change the mapping? When we tried it, we got a '"acknowledged": true' response, but it doesn't seem to be working when we tried indexing.
2. In case there is a way to achieve this, will it affect only the new documents being indexed?

--  
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/1b912d68-900f-4f6f-be5f-cbae83776e1b%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/1b912d68-900f-4f6f-be5f-cbae83776e1b%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/etPan.544f43de.643c9869.1405c%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.544f43de.643c9869.1405c%40MacBook-Air-de-David.local).  
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, 12:53am UTC](https://discuss.elastic.co/t/what-happens-to-data-in-an-existing-type-if-we-update-the-mapping-to-specify-paths-for--id-and--routing/20444/4 "2017-07-06T00:53:33Z")

</div>


