You want to try Elasticsearch on your own Windows laptop. Maybe to learn search, or to look at some logs, or to follow a tutorial. The good news is that you do not need an installer or a server. Elasticsearch and Kibana both come as zip files, and you run them from a folder.
There is one change that trips up almost everyone who follows older guides. Current versions of Elasticsearch turn on security from the first start. The address is https, there is a password, and Kibana connects with a one time token. If you follow a 2019 style guide, and open localhost:9200 in your browser, you will not get what the guide promises.
This guide installs both tools on Windows with the zip files, and follows the current Elastic documentation. We start Elasticsearch, save the details that it prints only once, check that it works, and then start Kibana and connect it. We also cover what to do if you miss the password, a token that has expired, or a port that is already in use.
| Tool | What it does |
|---|---|
| Elasticsearch | The search and analytics engine. It stores your data, and answers requests on port 9200 |
| Kibana | The web screen for Elasticsearch. You open it in a browser, on port 5601. It has Dev Tools, where you can type requests, and dashboards |
The old page called this the ELK stack. ELK stands for Elasticsearch, Logstash and Kibana. Logstash moves and prepares data, and this page does not install it, so here we install two of the three.
The old page said that your machine must have Java 1.8 or newer. That is no longer the first step. The Elastic docs say that the Elasticsearch zip includes a bundled OpenJDK. So you can skip Java. If you want to use your own Java, the docs tell you to follow the Java version rules in the Elastic documentation, and to set ES_JAVA_HOME for the service. They also say that a JRE works, but is discouraged, and causes a warning.
Download both zip files for Windows from the Elastic website. The old page gave the link to Elasticsearch only. Here are both.
https://www.elastic.co/downloads/elasticsearchUse the same version for both. The Elastic docs currently use 9.5.5 as the example version. Your download may be newer, so check the download page. In the commands below, I write VERSION where the version number goes.
Unzip both files. This creates two folders, such as elasticsearch-VERSION and kibana-VERSION-windows-x86_64. Keep the path short, and avoid a folder name with spaces if you can. The Elastic docs use C:\Program Files in one example, but a plain folder such as C:\elk is easier to type.
| Folder | What it holds |
|---|---|
| bin | The start scripts, such as elasticsearch.bat and elasticsearch-service.bat |
| config | The settings files, elasticsearch.yml and jvm.options |
| config\certs | The security certificates that are made on the first start |
| data | Your indexes and their shards |
| logs | The log files |
| plugins | Plugins that you add |
Open a Command Prompt. Go to the Elasticsearch folder, and run the start script. The old page spelt the folder name wrongly as ElaticSearch. Use your real folder name:
Leave this window open. Elasticsearch runs in the foreground, and prints its log in the window. To stop it later, press Ctrl and C.
This is the most important part of the new setup. On the very first start, Elasticsearch sets up security, and the Elastic docs say that it prints these things in the window.
Copy the password and the token into a safe place at once. The Elastic docs warn that these appear only on the first start. They also warn that if you send the output to a file, the automatic setup is skipped, so start it in the window, as shown above.
Never share the password in a screenshot, and never write a real password into a page or a script. In this guide I use your_password as a placeholder.
You can make new ones. Open a second Command Prompt in the Elasticsearch folder. To reset the password of the elastic user:
To make a new Kibana enrollment token, if the first one has expired:
Both tools are in the bin folder. In Command Prompt, use the backslash form shown above.
The old page said to open localhost:9200 in a browser. With security on, the address is https, and a browser will warn that the certificate is not trusted, then ask for a login. The Elastic docs show the check with curl, and Windows 10 and later include curl. Open a second Command Prompt, and go to the Elasticsearch folder. Use your own password in place of your_password:
The cacert option tells curl to trust the certificate file that Elasticsearch made. If it works, you get a short block of JSON. It holds the node name, the cluster name, the version, and a line with the tagline, You Know, for Search. I did not run it here, so I am not copying a full response. The exact numbers will be those of the version that you installed.
Use the same command later in a script, but keep the password out of the script file. Use a variable that you set in your own session.
The old page told readers to open the Kibana config file, and remove the hash from the line #elasticsearch.hosts with http://localhost:9200. Do not do this on a current version. That line points Kibana at an http address, and Elasticsearch now answers on https and needs a login. Also the old line used curly quotes, which break a YAML file. With enrollment, you do not need to edit the file at all.
Open a new Command Prompt, so that Elasticsearch keeps running in the first one. Go to the Kibana folder, and start it:
Kibana runs in the foreground, and prints its log. On the first start, according to the Elastic docs, it shows a unique link in the window. Then:
The Kibana page I read does not mention a verification code. Some versions may ask for one. If Kibana asks for a code, it is shown in the Kibana window, so check there.
If the token has expired, make a new one with the command in Step 2. If Kibana already has Elasticsearch details in its settings, it does not show the link, and you connect with the setup tool instead:
The default host and port of Kibana are localhost and 5601, so the address is localhost:5601 in your browser. The Elastic page gives the host and the port only. The usual address is http://localhost:5601, so use that if the link from the Kibana window is not available. The settings file is kibana.yml, in the config folder of Kibana, if you ever need to change something such as the port.
When you are in, open Dev Tools from the Kibana menu. This is a screen where you can type Elasticsearch requests. Try the first one:
If it returns a status, Kibana and Elasticsearch are talking. A one node cluster with the default of one replica shows yellow, which is normal for a test. Our basic concepts guide explains why. You can now follow our guides on index configuration, the document APIs, Query DSL and aggregations in this same window.
The old page said that the install is complete after the last step, but did not say that you need to keep both windows open. If you close the Elasticsearch window, Elasticsearch stops, and Kibana shows an error. The next time you want to work, start Elasticsearch first, and then Kibana. The password stays the same, and you do not need a new token, because Kibana remembers its connection.
If you do not want to keep a window open, the Elastic docs describe a way to install Elasticsearch as a Windows service. Open a Command Prompt as an administrator, in the Elasticsearch folder. The commands are:
The same script also takes stop, remove and manager. The manager command opens a window where you can change settings such as the memory. The Elastic docs also list a few service variables that you set before the install, such as ES_JAVA_HOME. Two details matter.
curl -u elastic:your_password http://localhost:9200.For a test machine, the defaults are fine. For anything bigger, the Elastic docs say that you can move the data and the logs out of the install folder, by setting path.data and path.logs in the elasticsearch.yml file. The config folder is found through the ES_PATH_CONF variable, and by default it is the config folder inside the install folder. Back up the data folder before you upgrade or move anything.
| Problem | Likely cause | What to do |
|---|---|---|
| The browser shows a certificate warning at localhost:9200 | Security is on, and the certificate is not trusted by the browser | Use the curl command with the cacert option |
| The check with http gets no useful answer | A command line start uses https | Use https, and the elastic login |
| I did not save the password | It is printed only on the first start | Run the reset password tool |
| The Kibana token is refused | It is valid for 30 minutes | Make a new one with the create enrollment token tool |
| Kibana cannot connect | Elasticsearch is not running | Start Elasticsearch first, and keep its window open |
| A port is already in use | Another program uses 9200 or 5601 | Close that program, or change the port in the config file |
| The service has no password | Security is not set up automatically for a service | Run the reset password tool after the first start |
| The config file will not load | Curly quotes, or a wrong indent in a YAML file | Type straight quotes, and keep the spacing |
Port numbers and the other settings of a node are in the elasticsearch.yml file. I did not test the port change here, so check the Elastic docs for the setting names before you change one.
Once you see Kibana and a working health check, your own lab is ready. Everything in our other Elasticsearch guides can be run in Dev Tools on this setup. A good next step is to read the basic concepts guide, then create your first index and add a few documents with the document APIs.