How does Elastic know that previous version is less than 8.18.0?

I'm upgrading Elasticsearch to the latest version 9.0.1. After installing I am getting an error saying I first need to upgrade to 8.18.0 before jump to 9.0.1. No problem if I'm upgrading manually, but I need this to work with automated scripts where the previous version of Elasticsearch may or may not be 8.18.0. What is it that Elasticsearch uses to determine the previous version was incompatible? Any thoughts on how to programmatically determine if I need to upgrade to 8.18.0 first?

The main issue here is that when upgrading between major versions it is required to first upgrade to the last minor and patch version, check the upgrade assistant, and then upgrade to the next major version.

You can't go from 8.17.X to 9.X for example, you need to go to 8.18.last-patch, check the upgrade assistant, and then go to 9.X.

2 Likes

If you mean a message like this ...

fatal exception while booting Elasticsearch java.lang.IllegalStateException: cannot upgrade a node from version [8.17.3] directly to version [9.0.1], upgrade to version [8.18.0] first.

... the version number is stored in the files in the data path. There isn't really a portable way to extract that number directly. The simplest thing to do is probably to always upgrade to 8.last first, which will be a safe no-op if the cluster is already on 8.last.

But what @leandrojmp says is important too, it's not just about hopping briefly on 8.18.0 before upgrading to 9.x. It's really important to stop on 8.last for a while, checking the upgrade assistant, as well as running all your tests and making sure there's no deprecation warnings.

1 Like