How to update mapping of an index and apply it to the data already in the index?

I am using Elastic Search v 2.3.1 with lucene v5.5.0. I have a requirement which wants me to update the existing mapping for the index.

The index already has a lot of documents. So, I was wondering if there is a way in which only index data is backed and restored after putting new mapping in Elastic search?

I tried the snapshot and restore way https://www.elastic.co/guide/en/elasticsearch/reference/2.3/modules-snapshots.html but its brings back the old mapping and new mapping is overridden.

How can map the data already residing in index with new mapping in Elastic search?

You can use the reindex API for that.

Thanks for replying and referring me reindex api.

I read it https://www.elastic.co/guide/en/elasticsearch/reference/2.3/docs-reindex.html#docs-reindex and it says it copies the snapshot. I have already tried with snapshot and it copies "data" along with "mapping" of an elastic search index.

Have I misread it? I will be trying out soon after this but does reindex copy only data?

It means that it copies the index at a given point of time, whatever operations will happen while the reindex operation is running.

It will solve your problem.

I have the same issue.
We are running an older version of Elasticsearch (1.7) with certain mappings and analyzers. When I try to create the same mappings (via .Net components) in the newest version of Elasticsearch it fails to create. Is there a way to convert/update the mappings to the newest version. The reindex api only copies data from one index to another without mappings.

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