Installing Elasticsearch on Windows
A free video tutorial from Bo Andersen
4.5 instructor rating • 4 courses • 62,333 students
Learn how to install Elasticsearch on Windows.
Learn more from the full courseComplete Guide to Elasticsearch
Learn Elasticsearch from scratch and begin learning the ELK stack (Elasticsearch, Logstash & Kibana) and Elastic Stack.
12:10:23 of on-demand video • Updated September 2020
- How to build a powerful search engine with Elasticsearch
- The theory of Elasticsearch and how it works under-the-hood
- Write complex search queries
- Be proficient with the concepts and terminology of Elasticsearch
English In this lecture, I am going to show you how to install Elasticsearch on Windows. When I say "install Elasticsearch," that's probably not entirely accurate, though. We won't be installing Elasticsearch as an application, because Elasticsearch just consists of a bunch of "jar" files, being Java archives. In case you are not familiar with "jar" files, they are basically just files that aggregate Java class files, metadata, and resources. You can think of them as zip files for Java projects. Elasticsearch itself is packaged as a "jar" file, along with its dependencies such as Apache Lucene. With these "jar" files, running Elasticsearch is as simple as running a convenient script that is distributed together with the "jar" files. You will see that in a moment. The point is that we will not be installing anything, but rather downloading the files needed to run Elasticsearch. Elasticsearch ships with a version of OpenJDK, which means that you don't need to install Java. If you have it installed already, Elasticsearch will use the JVM pointed to by the "JAVA_HOME" environment variable; otherwise it will use the bundled OpenJDK for your convenience. Alright, so let's get to business! I have the download page for Elasticsearch opened up. To save you from some clicking around, I have attached the link to this lecture. Simply click on the download link that matches your operating system, being Windows in this case. This will download a zip file. I have extracted the zip file in advance and moved its contents to the desktop, just to save a bit of time. We'll need the Command Prompt to start up Elasticsearch, so I have it opened up at the desktop. First, let's navigate to the extracted directory. I am going to show you the contents of this directory in a moment, but for now, let's just start up Elasticsearch to verify that everything works as intended. Doing so is extremely easy, as we just need to run a batch file named "elasticsearch.bat" located within the "bin" directory. Elasticsearch is now starting up, and should be ready within a moment or two. Alright, Elasticsearch is now up and running. That was easy, wasn't it? Elasticsearch is running in the foreground, meaning that if you close the Command Prompt window in which it is running, the process will be shut down. To shut it down more gracefully, you can press the CTRL and C keys simultaneously. Running Elasticsearch as a service (i.e. as a background process) is also easy, but that's a topic for later in the course. We don't see any errors within the output, so everything should work correctly. Just to be 100% sure, let's send a request to Elasticsearch. To be precise, we will send an HTTP request to the REST API. Elasticsearch is running on localhost at port 9200, so that's the endpoint that we will send a request to. To send the request, I will use the cURL command line tool, which should be available within the Command Prompt. You are also free to use any other HTTP client, such as Postman. If cURL is not available on your version of Windows, then I will show you how to do the same thing with PowerShell in a second. Let's open a second Command Prompt window. With cURL, all we need to do, is to write "curl" followed by the endpoint. This will use the "GET" HTTP verb by default. The response is a JSON object, meaning that everything is indeed working. Let's now do the same thing with PowerShell. Let's open up the PowerShell command line by searching for it in the start menu. In PowerShell, there is a command named "Invoke-RestMethod" that we can use. Following the command name, we just need to specify the endpoint of Elasticsearch, exactly as we did with cURL. So let's type that out. We see the same result as with cURL, with the exception that PowerShell formats the JSON result for us. That's all there is to (quote-unquote) "installing" Elasticsearch on Windows, so let's continue.