Elasticsearch is a flexible and powerful open source, distributed real-time search and analytics engine. Elasticsearch is a document-based database, i.e., it stores the data in JSON format.
Why Elasticsearch?
Elasticsearch can be used as a powerful search tool for your application. Because if you work with the relational database, it won’t allow a search for a large database which has millions of data sets. Then, you need to fine-tune it to achieve it, but Elasticsearch is readily available to search. You just need to Create an index, type, and Document and push the data into Elasticsearch and you are ready to search.
As a developer, we mostly use a relational database for storing the data which helps us to easily join tables and pull this data from the database which we require. Over time, as these databases and tables become fat, we are not able to do an operation on these databases and tables.
On the other hand, Elasticsearch tool can easily perform a search on millions of documents in a few seconds. The two unique and significant features of Elasticsearch are -
- Horizontal scale
- High availability
Various Elasticsearch Clients
- Java REST Client [6.2] — other versions
- Java API [6.2] — other versions
- JavaScript API
- Groovy API [2.4] — other versions
- .NET API [6.x] — other versions
- PHP API [6.0] — other versions
- Perl API
- Python API
- Ruby API
- Community Contributed Clients
For details of Elasticsearch Clients, click here.
We are going to focus on .NET API in the entire series.
Now, let’s start with setting up Elasticsearch. For doing that, first, we require to download the latest JDK.
Downloading java development kit
Since many of us are from .NET background, we may not know how to use Java in our programming. For that purpose, I am going to show it in simple steps so that a novice developer can also start using it in their application.
For downloading JDK, click here.
For this tutorial, I am going to use “Version 8 update 162” “(build 1.8.0_162-b12)”.
If you want to work with the same version which I am using, then this is the link to download.
- http://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase8-2177648.html
- https://www.filehorse.com/download-java-development-kit-64/33594/
After downloading Java JDK, next, we are going to install it.
Setting Java Home Variable
Once you have the JDK installation path, follow the below-mentioned process.
- Right-click the My Computer icon on your desktop and select Properties.
- Click the Advanced tab, then click the Environment Variables button.
- Under System Variables, click New.
- Enter the variable name as JAVA_HOME.
- Enter the variable value as the installation path for the Java Development Kit.
- Click OK.
- Click Apply Changes.
If you still do not get how to set up, then refer to this link here.
After installing, just open Windows command prompt and type the following command -
javac
If you get the error “javac: command not found” that indicates javac path is not set properly. Still, try to restart the computer and once again check the command.
If you get all Java options, then you have set the path properly, as shown below.
After completing the setting of Java Home Variable, next, we are going to download Elasticsearch.
Downloading Elasticsearch
After clicking on Download button, it will take you to another page where you will have various download options. In that, we are going to choose Zip options.
Given below is the view of Elasticsearch files after unzipping the folder.
Next, run the Elasticsearch tool.
Run Elastic search
Go to the bin folder of Elasticsearch.
Then, in header, type “cmd”. This will open the command prompt on the folder path you have set.
After coming to this path, next, enter “elasticsearch” keyword to start its instance, as shown below.
It will run on “127.0.0.0” address with port no “9200”.
Now, open your browser and enter localhost address “127.0.0.1” and with port no “9200”.
If you get this page, then you have successfully started Elasticsearch instance.
Now, we have completed the configuration of Elasticsearch on Windows. In the next part, we are going to learn how to create Index and document in Elasticsearch.