Yes, this error would happen when you try loading the repository's index file, which happens before trying to create a snapshot.
I would recommend the following to get you out of your predicament:
- disconnect your two clusters from the repository
- In your repository, at the top level directory, you will see some
index-Nfiles, where N is some number... for example,index-0,index-1, etc. Delete all of theindex-Nfiles, but do not delete theindexfile which does not have a-Nafter it. So keepindexbut delete allindex-Nblobs. - Create the repository in your 5.x cluster. This should generate fresh
index-Nfiles for you, based on the current state of the repository. - Now you can also create the repository in the 2.x cluster, just make sure you create it as
readonly: see https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html#_shared_file_system_repository for documentation on thereadonlyflag.