In this post, lets discus about the installation of Elasticsearch on windows.
The requirement for installing Elasticsearch is a Java. Elasticsearch recommends its user to install latest version of Java.
We can get the latest version of Java from the official website www.java.com.
The Elasticsearch package can be downloaded from the official link https://www.elastic.co/downloads/elasticsearch
The packages are available as follows,
Download zip file to install Elasticsearch on windows.
Unzip the package and place it appropriate directory as needed.
To run the Elasticsearch, traverse to elasticsearch\bin path in command prompt and open the elasticsearch.bat file.
By doing this, the Elasticsearch service will start running in command prompt. But when we close the command prompt, the Elasticsearch service will stop running.
So, the Elasticsearch should be installed as window service by running the following command in command prompt
elasticsearch\bin>service install
When command executed successfully, we will receive message as “The service elasticsearch-service-x64 has been installed”.
The Elasticsearch service can be start by using the following command
elasticsearch\bin>service start
Once the service is started, we can confirm it by browsing URL http://localhost:9200/ in browser.
If the service started successfully, it will return 200 status.
Note:
Sometimes, we get error while starting windows service which is installed using service install command.
Mostly, it will be because of JVM conflict with the environment variable %JAVA_HOME%. We can fix this by running the following command in command prompt which will set the default JVM to our elasticsearch service (reference)
elasticsearch-service-x64.exe //US//YOUR_SERVICE_NAME --Jvm auto
example:
elasticsearch-service-x64.exe //US//my-elastic-service --Jvm auto
where my-elastic-service is the custom name of our elasticsearch service.
One thought on “How to install Elasticsearch?”