Abubakkar Rangara Abubakkar Rangara - 23 days ago 6
PHP Question

Elastic search - renaming a type

I have a problem of re-indexing only part of the index data in elastic search.

Using PHP elastic search client.

Let's say I have an index

myindex
with types
type1
and
type2
.

Now some of the fields in
type2
changes and I need to change the mapping.

After reading their docs, I thought that I could get away by creating a new type and creating an alias, but unfortunately it seems that you cannot have alias for types, it's only applicable for index.

Then, I thought to create a new temporary mapping for
newtype2
, copy data from
type2
to
newtype2
and delete
type2
.

But now I cannot find any way to rename a type.

Answer

No, you can't rename a type.

Read this article: https://www.elastic.co/blog/changing-mapping-with-zero-downtime