How to Set Up Elasticsearch on Ubuntu 18.04?

What is Elasticsearch?

Elasticsearch is a distributed, open source search and analytics engine for all types of data, including textual, numerical, geospatial, structured, and unstructured.  Elasticsearch is built on Apache Lucene and was first released in 2010 by Elasticsearch N.V. You can write data on it using Spark and Hadoop application.

Steps to Install ES:

Setting up one node elasticsearch in your computer is not complex task. However the one who want to start to learn and know about it may face problem in the beginning. so My motive is to help to the beginner. Even as my experienced as software engineer I have also faced problem in the beginning  because of zero ideas about it.

Many people are unaware about the elasticsearch capability and they are relying  on traditional databases. Actually we can leverage the use of elasticsearch when we have large volume of data. When we talk about large volume of data big data strike our mind. So if you want to store data in structured format you can use elasticsearch besides this you can elasticsearch on different other search purposes. i will talk about elasticsearch more in depth in my future posts . So Now I want to start for the set up process.

Step 1:

Download elasticsearch tar file of your required version. But If you are beginner its better to download latest stable version from website  https://www.elastic.co/downloads/elasticsearch . You can select your required version by clicking link in circle as shown in figure below.

 

Step 2:

Untar tar file using the command tar -xvzf <tar-file-name-you-downloaded>

Step 3:

Then go inside the uncompressed directory , you will see multiple directories inside it. Then go inside config directory, there you will see elasticsearch.yml file .You have to edit that file and change  your elasticsearch cluster name from default name. For this you have to remove comment (remove #) from the line and change name according to your wish.

Step 4:

After saving the file then you can  run elasticsearch instances from the bin directory using command ./elasticsearch

 

Finally you are running your elasticsearch cluster. Now you can check your info about cluster from chrome/firefox browser using localhost:9200 as shown in figure below. You can also enter a command in terminal as curl -XGET localhost:9200


.

Basic Commands For ES:

So There are other commands that can be use for different information and you can hit from both browser and terminal.

Cluster Health:

localhost:9200/_health/cluster – cluster health  should be green for different read and write operation.

show indices:

http://localhost:9200/_cat/indices

create index:

curl -XPUT localhost:9200/indexname

delete index:

curl -XDELETE localhost:9200/indexname

These are pretty basic command for elasticsearch. There are others command too. I will write about them in future posts with different write and read operation queries using query sense in kibana.

Leave a comment if you get confused with given information. Feedback are appreciated.

About sgc908

Graduate Research Assistant at North Dakota State University, Precision Agriculture, Machine Learning, Deep Learning and Big Data.

View all posts by sgc908 →