Sometimes Elasticsearch service installation on Windows goes fine but when starting the service Elasticsearch, it does not start or it starts but dies after a few seconds.
If you’d visit the <ES_HOME>\logs directory, you will be able to see what is going wrong. You see error like the one listed below:
[info]  Starting service... [error]  Failed creating java %JAVA_HOME%\bin\server\jvm.dll [error]  The system cannot find the path specified. [error]  ServiceStart returned 1 [error]  The system cannot find the path specified. [info] [ 9824] Run service finished. [info] [ 9824] Commons Daemon procrun finished [error]  Failed to start 'elasticsearch-service-x64' service [error]  The data area passed to a system call is too small. [info]  Start service finished. [error]  Commons Daemon procrun failed with exit value: 5 (Failed to start service) [error]  The data area passed to a system call is too small. [info] [ 5180] Commons Daemon procrun (126.96.36.199 64-bit) started [info] [ 5180] Service elasticsearch-service-x64 name Elasticsearch 2.3.2 (elasticsearch-service-x64) [info] [ 5180] Service 'elasticsearch-service-x64' installed [info] [ 5180] Commons Daemon procrun finished [info] [ 8332] Commons Daemon procrun (188.8.131.52 64-bit) started [info] [ 8332] Starting service 'elasticsearch-service-x64' ... [info]  Commons Daemon procrun (184.108.40.206 64-bit) started [info]  Running 'elasticsearch-service-x64' Service...
If you did Elasticsearch DPK install, this error is most likely due to incorrect JAVA_HOME reference and if you did manual install of Elasticsearch, this error is either due to incorrect elasticsearch.yml file or incorrect JAVA_HOME reference.
Try the following troubleshooting options:
- Verify elasticsearch.yml does not have syntax or indentation errors. You can open it in Notepad++ or Sublime Text editors for better reference.
- Verify that the JAVA_HOME environment variable specified is correct.
- Verify that PATH environment variable does not point to a different JAVA_HOME. Elasticsearch needs a specific version of JRE to work properly and the your PATH variable may be referencing old JRE path.
- If it still does not work, try deleting your Elasticsearch service and installing it again. Run the following command under admin mode: SC DELETE elasticsearch-service-x64