Search code examples
elasticsearchelasticsearch-5reindex

Elasticsearch reindex from 2.x to 5.x


I did an upgrade of my elasticsearch instance from elasticsearch-2.x to elasticearch-5.6 . Everything seems to work fine. But before i do an upgrade to version 6, I have to reindex data. Whats does reindexing mean?

I have a script that is creating all data i need on elasticsearch. Do i have to start this script. But in this case it would be the same like i would remove all indices and install all dumps back into elasticsearch.

I dont know how to try this because i dont know the "right way" to do it.

EDIT I did now found the api with _reindex post. Do i have to do this for all indexes i have or is there an application i don't know that is doing this maybe faster than me :-)


Solution

  • First, why is this necessary: Behind the scenes Apache Lucene is writing the data. Lucene can always write its current version and read the previous one.

    • Elasticsearch 2.x == Lucene 5
    • Elasticsearch 5.x == Lucene 6
    • Elasticsearch 6.x == Lucene 7

    If you have upgraded from 2.x, you need to make sure that all the data has been written with Lucene 6 before you can upgrade to Elasticsearch 6.x. You can actually check this in the version information of all the Lucene segments with GET /_segments (this might give you a lot of information).

    What you want to run to get this done is the reindex in place. And I can highly recommend the free X-Pack Basic migration assistant to make sure you have upgraded all indices and don't have any other hidden upgrade problems.