'Upgrading Solr from 6.x to 8.x and Keeping the data
I'm trying to upgrade from Solr 6.x to 8.x and I'm facing an issue of keeping/saving/importing the old data that I've had.
The approaches I tried
using the same solr directory -- that was a Big failure xD
Backup / restore :
as explained in the documentation, I manage to create backups with Solr 6 but when i try to restore it it shows me an OK message but it doesn't restore/import any of the data, the collection stays empty.
the message returned was
{ "responseHeader":{ "status":0, "QTime":10}, "status":"OK"}
exporting query result from collections:
I exported the result of the an empty query to get all the object and saved the result as a json file, and then tried to import it again using curl command. I get a version conflict message. unless i remove the result header and version field of each document, but this way I'm losing all the indexes. and its a manual process
Are there any ways to do that easily and seamlessly. And how can I re-index the data after I import it again?
P.s I've looked at these questions, but they weren't very helpful to me.
Solution 1:[1]
if any one is facing the same issue i will post here what worked for me. Going through 7.x didn't work for me, so here what is what i did and how i solved it.
I've created a java application that will export all of the data via rest requests to Solr, and saving the results into json files, while removing the "version" field. (i've added pagination, saved data in bulks so wont have huge files)
then after installing the new Solr 8.x under different directory, and removing the old solr.
The tool will read those those files into list of the same objects (if you want to save the indexes you have) and then save them in the new Solr database, via post requests. (it can be done directly from the json files via post requests to solr if you don't have indexes or any other special stuff)
Hope This helps you guys, thanks
P.S. Thanks to @MatsLindh for helping and making the stuff more clear
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Majd Mahajenah |