Upgrade Assistant Reindex Helper leaves old indices undeleted, can I test if operation is complete?

Hi,

I've been using the Upgrade Assistant in 5.x to reindex indices from 2.x. I'm noticing that some of them didn't complete the process and when I click on the reindex button I get the following message:

Index foo-reindexed-v5 already exists. There may be an unfinished task reindexing to this index, or this index may have not been cleaned up previously.

I then used the cat API to view the indexes and notice that some of the old foo indices and the foo-reindexed-v5 indices both exist and have similar sizes. Is there any way I can tell if the operation was fully successful so I can at least manually delete the old foo index and avoid re-processing all of those indices?

Thanks!
Dave

me too. +1

There may be a bug here (cc: @a5a).

In the meantime, you could manually complete the operation like so:

  1. Check to make sure the document count in the new index matches the old index:
GET /_cat/indices?v
  1. Check to make sure the reindex task is complete. The following command should return nothing for the associated index:
GET _tasks?detailed=true&actions=*reindex
  1. Once the above is verified, you can delete the original index and create an alias
​DELETE foo
POST /_aliases
{
    "actions" : [
        { "add" : { "index" : "foo-reindexed-v5", "alias" : "foo" } }
    ]
}

@PhaedrusTheGreek Post of the year!

I had multiple indexes with this message. I deleted all of them but got into trouble because some of the migrated indexes DID clean up properly. As a result, I deleted the new indexes by the old index name. Wrote some python to automate the generation of the commands. I remove all the aliases first. delete the originals, then add the alias back. If you copy all the commands into dev tools, you can select all of them and click run. It will execute them consecutively.

indexs = [
     'logstash-2016.25-reindexed-v5',
     'logstash-2016.40-reindexed-v5',
     'logstash-2016.42-reindexed-v5',
     'logstash-2016.43-reindexed-v5',
     'logstash-2016.48-reindexed-v5',
     'logstash-2016.49-reindexed-v5',
     'logstash-2016.51-reindexed-v5',
     'logstash-2016.52-reindexed-v5',
     'logstash-2017.01-reindexed-v5',
     'logstash-2017.02-reindexed-v5',
     'logstash-2017.03-reindexed-v5',
     'logstash-2017.04-reindexed-v5',
     'logstash-2017.05-reindexed-v5',
     'logstash-2017.06-reindexed-v5',
     'logstash-2017.09-reindexed-v5',
]


 for index in indexs:
     index_oringinal = index.replace("-reindexed-v5", "")

     print("POST /_aliases")
     print("{")
     print("\t\"actions\" : [ ")
     print('\t\t{ "remove" : { "index" : "'+ index +'", "alias" : "'+ index_oringinal +'" } }')
     print("\t]")
     print("}")

 for index in indexs:
     index_oringinal = index.replace("-reindexed-v5","")
     print("DELETE " + index_oringinal)

 for index in indexs:
     index_oringinal = index.replace("-reindexed-v5", "")

     print("POST /_aliases")
     print("{")
     print("\t\"actions\" : [ ")
     print('\t\t{ "add" : { "index" : "'+ index +'", "alias" : "'+ index_oringinal +'" } }')
     print("\t]")
     print("}")

BONUS:

copied the entire kabana page into https://regex101.com and filtered on:
\"message\": \"Index (.*?) already exists
to get all the index names.

Thanks for the help guys! I ended up just restoring a file system snapshot and re-processing but this should help future googlers

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