First of all make sure java jdk is installed on your system. Then go to environment variables of your system. Add new variable called "JAVA_HOME" and add variable value as the path where jdk is installed on your system (eg: C:\Program Files\Java\jdk-12.0.1) and then press ok as shown in figure below:
Now, open cmd type echo %JAVA_HOME% ,if it shows the path entered previously while creating new variable then its ok. If everything is all right upto this point, go to the folder when the files of elasticsearch is located through cmd (for eg have my folder on G: drive so my path looks like
G:\elasticsearch\bin> ). Finally, enter elasticsearch-service.bat install.
If you see output as shown below then your installation has been successful.
G:\elasticsearch\bin>elasticsearch-service.bat install
Installing service : "elasticsearch-service-x64"
Using JAVA_HOME (64-bit): "C:\Program Files\Java\jdk-12.0.1"
The service 'elasticsearch-service-x64' has been installed.
To run elasticsearch service, again enter given command entering into the bin of your elasticsearch folder as shown below:
G:\elasticsearch\bin>elasticsearch-service.bat manager
Running this command will display a window as shown in figure below:
Click "Start" button to start the service. Wait for few seconds or a minute, then open browser and type the given URL: http://localhost:9200/ , you can the output as shown below if everything is fine.
Now, open cmd type echo %JAVA_HOME% ,if it shows the path entered previously while creating new variable then its ok. If everything is all right upto this point, go to the folder when the files of elasticsearch is located through cmd (for eg have my folder on G: drive so my path looks like
G:\elasticsearch\bin> ). Finally, enter elasticsearch-service.bat install.
If you see output as shown below then your installation has been successful.
G:\elasticsearch\bin>elasticsearch-service.bat install
Installing service : "elasticsearch-service-x64"
Using JAVA_HOME (64-bit): "C:\Program Files\Java\jdk-12.0.1"
The service 'elasticsearch-service-x64' has been installed.
To run elasticsearch service, again enter given command entering into the bin of your elasticsearch folder as shown below:
G:\elasticsearch\bin>elasticsearch-service.bat manager
Running this command will display a window as shown in figure below:
Click "Start" button to start the service. Wait for few seconds or a minute, then open browser and type the given URL: http://localhost:9200/ , you can the output as shown below if everything is fine.
The elastic service can also be run through windows services. Search for services on search box on windows 10 and click on it to open services window. Then search for "Elasticsearch" and right click on it and select "Start". Again, wait for few seconds and go to http://localhost:9200/ to check if service is running or not.