[[windows]] === Install Elasticsearch on Windows Elasticsearch can be installed on Windows using the `.zip` package. This comes with a `service.bat` command which will setup Elasticsearch to run as a service. The latest stable version of Elasticsearch can be found on the link:/downloads/elasticsearch[Download Elasticsearch] page. Other versions can be found on the link:/downloads/past-releases[Past Releases page]. [[install-windows]] ==== Download and install the `.zip` package Download the `.zip` archive for Elastisearch v{version} from: https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/zip/elasticsearch/{version}/elasticsearch-{version}.zip Unzip it with your favourite unzip tool. This will create a folder called +elasticsearch-{version}+, which we will refer to as `$ES_HOME`. In a terminal window, `CD` to the `$ES_HOME` directory, for instance: ["source","sh",subs="attributes"] ---------------------------- CD c:\elasticsearch-{version} ---------------------------- [[windows-running]] ==== Running Elasticsearch from the command line Elasticsearch can be started from the command line as follows: [source,sh] -------------------------------------------- .\bin\elasticsearch -------------------------------------------- By default, Elasticsearch runs in the foreground, prints its logs to `STDOUT`, and can be stopped by pressing `Ctrl-C`. include::check-running.asciidoc[] [[windows-service]] ==== Installing Elasticsearch as a Service on Windows Elasticsearch can be installed as a service to run in the background or start automatically at boot time without any user interaction. This can be achieved through the `service.bat` script in the `bin\` folder which allows one to install, remove, manage or configure the service and potentially start and stop the service, all from the command-line. ["source","sh",subs="attributes,callouts"] -------------------------------------------------- c:\elasticsearch-{version}{backslash}bin>service Usage: service.bat install|remove|start|stop|manager [SERVICE_ID] -------------------------------------------------- The script requires one parameter (the command to execute) followed by an optional one indicating the service id (useful when installing multiple Elasticsearch services). The commands available are: [horizontal] `install`:: Install Elasticsearch as a service `remove`:: Remove the installed Elasticsearch service (and stop the service if started) `start`:: Start the Elasticsearch service (if installed) `stop`:: Stop the Elasticsearch service (if started) `manager`:: Start a GUI for managing the installed service Note that the environment configuration options available during the installation are copied and will be used during the service lifecycle. This means any changes made to them after the installation will not be picked up unless the service is reinstalled. Based on the architecture of the available JDK/JRE (set through `JAVA_HOME`), the appropriate 64-bit(x64) or 32-bit(x86) service will be installed. This information is made available during install: ["source","sh",subs="attributes"] -------------------------------------------------- c:\elasticsearch-{version}{backslash}bin>service install Installing service : "elasticsearch-service-x64" Using JAVA_HOME (64-bit): "c:\jvm\jdk1.8" The service 'elasticsearch-service-x64' has been installed. -------------------------------------------------- NOTE: While a JRE can be used for the Elasticsearch service, due to its use of a client VM (as oppose to a server JVM which offers better performance for long-running applications) its usage is discouraged and a warning will be issued. [float] === Customizing service settings There are two ways to customize the service settings: Manager GUI:: accessible through `manager` command, the GUI offers insight into the installed service including its status, startup type, JVM, start and stop settings among other things. Simply invoking `service.bat` from the command-line with the aforementioned option will open up the manager window: image::images/service-manager-win.png["Windows Service Manager GUI",align="center"] Customizing `service.bat`:: at its core, `service.bat` relies on http://commons.apache.org/proper/commons-daemon/[Apache Commons Daemon] project to install the services. For full flexibility such as customizing the user under which the service runs, one can modify the installation parameters to tweak all the parameters accordingly. Do note that this requires reinstalling the service for the new settings to be applied. NOTE: There is also a community supported customizable MSI installer available: https://github.com/salyh/elasticsearch-msi-installer (by Hendrik Saly). [[windows-layout]] ==== Directory layout of `.zip` archive The `.zip` package is entirely self-contained. All files and directories are, by default, contained within `$ES_HOME` -- the directory created when unpacking the archive. This is very convenient because you don't have to create any directories to start using Elasticsearch, and uninstalling Elasticsearch is as easy as removing the `$ES_HOME` directory. However, it is advisable to change the default locations of the config directory, the data directory, and the logs directory so that you do not delete important data later on. [cols="