Upgrade Elasticsearch on Windows

Upgrade Elasticsearch on Windows

1. Stop elasticsearch service on every node or just on the server if it's a standalone deployment.

2. Create a new system environment variable called ES_JAVA_HOME (in newer versions, the jdk must be specified manually):

ES_JAVA_HOME="C:\Program Files\Elastic\Elasticsearch\elasticsearch_version\jdk"

ES_JAVA_HOME="C:\Program Files\Elastic\Elasticsearch\elasticsearch_version\jdk"

3. Change the ES_HOME env to reflect the new path:

ES_HOME="C:\Program Files\Elastic\Elasticsearch\elasticsearch_version"

At this point you can navigate to Kibana->Management->Upgrade Assistant

Here you can see if your environment is ready for upgrade or if you have critical issues that must be fixed beforehand.

Open a CMD as admin and navigate to the new version of ES under the "bin" folder:

cd "C:\Program Files\Elastic\Elasticsearch\elasticsearch-7.17.1\bin"

elasticsearch.bat

Make sure that is running and if there are no errors.

After this, you can make it run as a service using your preferred method (elasticsearch provided script or nssm)