Elasticsearch is an Open Source  (Apache 2), Distributed search engine built on top of Apache Lucene. It allows you start with one machine and scale to ‘n’ number of servers with high availability.

Elasticsearch makes it easy to run a full-featured search server. It can be setup in lesser than five minutes. In this blog I’ll show how to:-

  • Install and run elasticsearch.
  • Indexing data.
  • searching
Installing and running Elasticsearch
  1. Download and unzip the latest version of Elasticsearch from elastic.co website.
  2. Go to the extracted folder, and Run bin/elasticsearch  on Unix or bin/elasticsearch.bat  on Windows, your terminal will be showing something like below.


3.   Open web browser and point the url to http://localhost:9200/ , you should see something like below


Indexing data

There are to main ways in adding data to elasticsearch.

  1. json over HTTP
  2. Native client.

Here we are using the curl command to insert data into elasticsearch

$ curl -XPUT ‘http://localhost:9200/twitter/tweet/1’ -d ‘{

“user” : “kimchy”,

“post_date” : “2009-11-15T14:12:12”,

“message” : “trying out Elasticsearch”


the result of the above index operation is:


“_index” : “twitter”,

“_type” : “tweet”,

“_id” : “1”,

“_version” : 1,

“created” : true