How to config Elastic search in our local system

Do you want to know how to config elastic search in local sytem?Today now in this blog i will show you how to config a Elastic search in our local system.Just need to follow this step and easily config an Elastic Search.

1) Step 1 — Installing Java :

So Before installing the OpenJDK with APT, update all the list of available packages for installation on our Ubuntu Droplet by running the bellow command:

$ sudo apt-get update

Now after that, we can install the OpenJDK with the command:

$ sudo apt-get install openjdk-7-jre

Need to verify our JRE is installed and we can be used, by run the command:

$ java -version
2) Step 2 — Downloading and Installing Elasticsearch :
$ wget

So now need to install it in the usual Ubuntu way with the dpkg command as like this:

$ sudo dpkg -i elasticsearch-1.7.2.deb

So now need to make sure Elasticsearch starts and stops it automatically with the Droplet, add its init script to the default run levels also with the command:

$ sudo update-rc.d elasticsearch defaults
Step 3 — Configuring Elastic :

For start editing the main elasticsearch.yml configuration file:

$ sudo nano /etc/elasticsearch/elasticsearch.yml

Need to Remove the # character at the beginning of the lines for the and also to uncomment them, and then need to change their values. “My First Node” mycluster1

If once we make all the changes, need please save and exit the file. So now we can start Elasticsearch for the first time also with the command:

$ sudo service elasticsearch start
Step 4 — Securing Elastic :

We know that elasticsearch has no built-in security and also it can be controlled by anyone who can access the HTTP API. So, the first security tweak is to prevent the public access. Need to remove the public access edit the file elasticsearch.yml:

$ sudo nano /etc/elasticsearch/elasticsearch.yml

Need to find the line that contains network.bind_host, uncomment it by the removing the # character at the beginning of the line, and also change the value to localhost so it now looks like this:

network.bind_host: localhost

For disable custom to expressions, need to add the following line is at the end of the /etc/elasticsearch/elasticsearch.yml file:

script.disable_dynamic: true

Step 5 — Testing :
$ curl -X GET 'http://localhost:9200' or run http://localhost:9200 in any browser.

Now we should see the following response:


"status" : 200,

"name" : "Harry Leland",

"cluster_name" : "elasticsearch",

"version" : {

"number" : "1.7.2",

"build_hash" : "e43676b1385b8125d647f593f7202acbd816e8ec",

"build_timestamp" : "2015-09-14T09:49:53Z",

"build_snapshot" : false,

"lucene_version" : "4.10.4" 


"tagline" : "You Know, for Search" 


Read Also :Laravel Join with Subquery in Query Builder Example

Thanks for read. I hope it help you. For more you can follow us on facebook.


About Shahriar Sagor

My name is Shahriar sagor. I'm a developer. I live in Bangladesh and I love to write tutorials and tips that will help to other Developer's. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.

View all posts by Shahriar Sagor →