# Changing mappings or renaming an index

**URL:** <https://discuss.elastic.co/t/changing-mappings-or-renaming-an-index/2822>\
**Category:** Elasticsearch\
**Created:** [February 19, 2010, 5:08pm UTC](https://discuss.elastic.co/t/changing-mappings-or-renaming-an-index/2822 "2010-02-19T17:08:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [February 19, 2010, 5:08pm UTC](https://discuss.elastic.co/t/changing-mappings-or-renaming-an-index/2822/1 "2010-02-19T17:08:42Z")

</div>

Hiya

From what I can see, one a field has been assigned a type (either  
explicitly with create\_mapping or automatically by indexing a  
document) it is immutable. Even updating the mapping won't change  
that field type.

Will it be possible to change the field type with create\_mapping in  
the future?

If not, then will it be possible to rename indices or types?

For example:

- I create\_mapping with { foo: { type: "string" }}
- later I want to change it to { foo: {type: "int" }}
- but I still want my current index 'my\_index' available while I  
generate a new index 'new\_my\_index'
- once the new index is up to date, i want to drop the old index,  
and rename the new one to 'my\_index'

Is that possible?

thanks

Clint

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [February 19, 2010, 10:47pm UTC](https://discuss.elastic.co/t/changing-mappings-or-renaming-an-index/2822/2 "2010-02-19T22:47:04Z")

</div>

Changing the type of a field will probably not be supported in the future.  
Basically, it requires complete reindexing of the system.

What I do plan to provide is the ability to get one index, and completely  
reindex it into another index. Since we have the source json for each  
document, we can do that. So you should be able to create a new index,  
create mappings to it, and then reindex.

Until that feature is done, I am working on a simpler feature allowing to  
execute a search query and scroll it (you get a scroll id back, and continue  
scrolling with it until exhausted). When you have that, you can implement  
reindexing yourself.

-shay.banon

On Fri, Feb 19, 2010 at 7:08 PM, Clinton [clinton@iannounce.co.uk](mailto:clinton@iannounce.co.uk) wrote:

> Hiya
> 
> From what I can see, one a field has been assigned a type (either  
> explicitly with create\_mapping or automatically by indexing a  
> document) it is immutable. Even updating the mapping won't change  
> that field type.
> 
> Will it be possible to change the field type with create\_mapping in  
> the future?
> 
> If not, then will it be possible to rename indices or types?
> 
> For example:
> 
> - I create\_mapping with { foo: { type: "string" }}
> - later I want to change it to { foo: {type: "int" }}
> - but I still want my current index 'my\_index' available while I  
> generate a new index 'new\_my\_index'
> - once the new index is up to date, i want to drop the old index,  
> and rename the new one to 'my\_index'
> 
> Is that possible?
> 
> thanks
> 
> Clint

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [February 20, 2010, 5:28pm UTC](https://discuss.elastic.co/t/changing-mappings-or-renaming-an-index/2822/3 "2010-02-20T17:28:52Z")

</div>

> What I do plan to provide is the ability to get one index, and  
> completely reindex it into another index. Since we have the source  
> json for each document, we can do that. So you should be able to  
> create a new index, create mappings to it, and then reindex.

OK great - at the end of the process, will we be able to drop the old  
index and rename the new one?

Otherwise it means making changes to an application, or using versioned  
index names

ta

## clint

Web Announcements Limited is a company registered in England and Wales,  
with company number 05608868, with registered address at 10 Arvon Road,  
London, N5 1PR.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [February 20, 2010, 10:31pm UTC](https://discuss.elastic.co/t/changing-mappings-or-renaming-an-index/2822/4 "2010-02-20T22:31:26Z")

</div>

Yes, support for renaming an index should be there as well (or at least,  
synonyms, like ln -s and unlink).

-shay.banon

On Sat, Feb 20, 2010 at 7:28 PM, Clinton Gormley [clinton@iannounce.co.uk](mailto:clinton@iannounce.co.uk)wrote:

> > What I do plan to provide is the ability to get one index, and  
> > completely reindex it into another index. Since we have the source  
> > json for each document, we can do that. So you should be able to  
> > create a new index, create mappings to it, and then reindex.
> 
> OK great - at the end of the process, will we be able to drop the old  
> index and rename the new one?
> 
> Otherwise it means making changes to an application, or using versioned  
> index names
> 
> ta
> 
> ## clint
> 
> Web Announcements Limited is a company registered in England and Wales,  
> with company number 05608868, with registered address at 10 Arvon Road,  
> London, N5 1PR.

---

<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, 4:25am UTC](https://discuss.elastic.co/t/changing-mappings-or-renaming-an-index/2822/5 "2017-07-06T04:25:36Z")

</div>


