Changing mappings or renaming an index

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

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 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

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.

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.ukwrote:

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.