I was installed latest version of ElasticSearch (8.6.2) and it worked fine. Then i realized that i need an older version (8.4.0), so i uninstalled it and then installed the older one.
Now when i try to start it it fails. In logs (/var/log/elasticsearch/elasticsearch.log) i found the error message – java.lang.IllegalArgumentException: Could not load codec 'Lucene95'. Did you forget to add lucene-backward-codecs.jar?
.
What to do? I am not used to java, and its libraries. So i dont even know from what to start.
As if found before the advise to download https://dlcdn.apache.org/lucene/java/9.5.0/ lucene9.5.0 and copy it`s folders into /lib directory. I tried it, but it didnt help me.
3
Answers
As far as I understood, the issue was in not deleted libraries that were installed by the highest version. And the older version tried to use them. After I removed them, and reinstalled the older version, it started. sudo rm -rf /var/lib/elasticsearch/ sudo rm -rf /etc/elasticsearch
Well, just by the message itself – I would try to add the package
lucene-backward-codecs
to your dependencies (maven/gradle)https://mvnrepository.com/artifact/org.apache.lucene/lucene-backward-codecs
ElasticSearch (8.6.2) depends on lucence codec 9.4.2.
ElasticSearch (8.4.2) depends on lucence codec 9.3.0.
see https://mvnrepository.com/artifact/org.elasticsearch/elasticsearch for dependency.
Probably, you index some data whith es 8.6.2, and then you degrade to es 8.4.2, lucene use codec 9.3.0 to decode data encoded with 9.4.2, it fails.
You can delete indexed data if the data is not important, or try to reindex to ElasticSearch (8.4.2).