Search code examples
elasticsearchelastic-stackelasticsearch-5

How to migrate data from elasticsearch 5.6 to elasticsearch 8.3


I have an elastic search cluster running 5.6. I plan to upgrade my cluster but i plan to do it by basically running a ES cluster 8.3 running in parallel and then moving data over to it.

The preferred way i think is to do snapshot and restore https://www.elastic.co/guide/en/elasticsearch/reference/current/snapshot-restore.html

But I am confused about what exactly Snapshot version compatibility mean : enter image description here

In the above does it mean that if i take a snapshot in elasticsearch 5.6, I cannot restore directly in version 8.3 ?? (which mean I have to first move to 6.x then to 7.x and finally to 8.x ) ??

The below index compatibility matrix, however says that a version in 5.x will work in 8.x ?

enter image description here

Am i missing something ? or can someone help me elaborate this?


Solution

  • So, the underlying problem is that data written in Lucene version N, can only be read with N+1. For Elasticsearch 5 to 8 the Lucene version was always 1 greater than the ES version (so 6 to 9).

    That means, both for an upgrade or a restored snapshot: If your data was written with 5.x, you can only read / restore it with 6.x. For 7.x or 8.x you'll need to reindex the data. I would do a remote reindex straight from 5.x to 8.latest if possible: https://www.elastic.co/guide/en/elasticsearch/reference/current/reindex-upgrade-remote.html

    There are some small caveats but they will probably not apply to you:

    1. This doesn't apply to source only snapshots, but those always need a reindex, so that's not going to add any benefit for you.
    2. 8.3 added a feature to still read snapshots from 5.0 on but it is slower, doesn't support all features, and it is a commercial feature (platinum license if I'm not mistaken).

    Depending on what kind of data it is: If it's aging out (like logs or metrics), maybe you don't have to migrate it to the new cluster?