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?
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("}")
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.