How to Solve elasticSearch8.1.2 Install Error in Win10

 

1. Error: there should be no \java\jdk1.8.0_20

Solution:
when the Java environment variables are set correctly, it may be because the Java installation path contains spaces and brackets. Reinstall java to a new path without spaces to start successfully
for example, the location of my environment variable JAVAHOME was original:

C:\Program Files (x86)\Java\jdk1.8.0_20

Change it to:

C:\Progra\Java\jdk1.8.0_20

2. An error is reported: ‘elasticsearch.bat ‘is not an internal or external command, nor is it a runnable program or batch file

Check whether you filled in the configuration file, if not, just add the following configuration parameters at the bottom of the elasticsearch.yml file

# Change the name of the cluster so that it doesn't get mixed up with someone else's cluster
cluster.name: el-m

# Change the name of the node
node.name: el_node_m1

# Change the listening address of the ES so that other machines can access it
network.host: 0.0.0.0

# Set the http port for the external service, the default is 9200
http.port: 9200

# Set the path to store the index data
path.data: E:\elasticsearch-8.1.2\data #Switch to your own path
# Set the path to store log files
path.logs: E:\elasticsearch-8.1.2\logs #Switch to your own path

# Turn off http access restrictions
xpack.security.enabled: false

# Add new parameter, head plugin can access es

http.cors.enabled: true
http.cors.allow-origin: "*"

3. Command line printing error log

please check that any required plugins are installed, or check the breaking changes documentation for removed settings

Solution: please refer to the above configuration file
the version of elasticSearch has been updated and changed greatly. When the configuration file is filled with redundant configuration, the above error message may be reported.

Read More: