Setting up environment variables in Windows10

my problem is in setting up environment variables once setting up Elasticsearch environment variables for local use. The instructions I follow can be found from: https://www.elastic.co/guide/en/elasticsearch/reference/current/zip-windows.html

First of all, does it matter that do I set up environment variables to user or system? By default, I try to set up everything as system variables. Is there something else in setting these variables than just pointing to root folder (C:\Program Files\Elastic in my case where I extracted the elasticsearch zip package)? The instructions are very short and I'm not sure which variables should I point to elasticsearch folder and which to java install folder. Also, does it matter if I have the these download folders outside C drive and should these environmental variables work once I'm setting them up or later in the setting up process?

Either way, when I'm trying to call any of these variables but they don't seem to work. I think also there should be an easier way to set these up instead of going each one through manually.

Following is the elasticsearch documentation I'm referring to:

"Customizing service settings The Elasticsearch service can be configured prior to installation by setting the following environment variables (either using the set command from the command line, or through the System Properties->Environment Variables GUI).

SERVICE_ID

A unique identifier for the service. Useful if installing multiple instances on the same machine. Defaults to elasticsearch-service-x64.

SERVICE_USERNAME

The user to run as, defaults to the local system account.

SERVICE_PASSWORD

The password for the user specified in %SERVICE_USERNAME%.

SERVICE_DISPLAY_NAME

The name of the service. Defaults to Elasticsearch %SERVICE_ID%.

SERVICE_DESCRIPTION

The description of the service. Defaults to Elasticsearch Windows Service - https://elastic.co.

JAVA_HOME

The installation directory of the desired JVM to run the service under.

SERVICE_LOG_DIR

Service log directory, defaults to %ES_HOME%\logs. Note that this does not control the path for the Elasticsearch logs; the path for these is set via the setting path.logs in the elasticsearch.yml configuration file, or on the command line.

ES_PATH_CONF

Configuration file directory (which needs to include elasticsearch.yml, jvm.options, and log4j2.properties files), defaults to %ES_HOME%\config.

ES_JAVA_OPTS

Any additional JVM system properties you may want to apply.

ES_START_TYPE

Startup mode for the service. Can be either auto or manual (default).

ES_STOP_TIMEOUT

The timeout in seconds that procrun waits for service to exit gracefully. Defaults to 0."

Thanks a bunch for all the help already in advance! :slight_smile:

Hello Elija,

It is generally a bad idea to manually fiddle with contents of Program Files. I suggest you create a directory, say C:\ElasticStack\elasticsearch and extract the zip there. Program Files is a special location with special permissions, which prevent writes by non-elevated users. You will experience problems running anything from that location that assumes it can write to the same [sub] directory.

It does't matter if you run ES as your user, however you will have to restart the shell/prompt you're running when you add/change a value. Further, any application that is started by the system (services for example) will not "see" the new variable until you restart the system. When ES runs as a service under default service account, you must add variables to the System location and restart the box for guaranteed results.

On a side note, Elasticsearch is not supported in Windows 10. Please refer to our support matrix for further details.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.