Install Elasticsearch and Kibana on MacOS (Macbook M1)

Elasticsearch is a distributed, open-source search and analytics engine built on Apache Lucene and developed in Java.

In this article i will how to install Elasticsearch and kibana to visualize the data on MacOS specific on Macbook M1, M1 Max and M1 pro.

To download Elastic search just go to this link

and choose MacOS and Click on macOS this will start downloading the elasticsearh.tar.gz

Also download kibana from

and choose MacOS and Click on macOS this will start downloading the kibana.tar.gz

Before running Elastic search and Kibana make sure that Java JDK and JAVA_HOME are properly installed in to your system.

If you haven’t installed Java JDK just download from Oracle.com

https://download.oracle.com/java/17/latest/jdk-17_macos-x64_bin.dmg

and once you instal Java jdk to check if java jdk is properly installed or not just open terminal and type java -version

If you are still getting confusion refer to this video

Once you install Java jdk you need to set up JAVA_HOME on your system for that open terminal and just type

/usr/libexec/java_home

and just open any code editor in my case i will open vscode and add into the .zprofile. If your default terminal is bash you need you add in .bash_profile. So to open .zprofile file on vscode.

code .zprofile 

To check if JAVA_HOME has been successfully set up in to the system just type this command in terminal.

echo $JAVA_HOME

Once JAVA_HOME is successfully set up just go to the download location of elasticsearch and kibana. And double click on each to extract the tar.gz files.

And open the terminal and navigate the elasticsearch.yml file and open with any editor.

elasticsearch7.15.1/config/elasticsearch.yml

And add this line at the bottom of the file.

xpack.ml.enabled: false 

Once you do that open terminal and navigate the elasticsearch-7.15.1/bin

and type

./elasticsearch

and wait for some time for elastic search to start if it does not show any error go to browser and type http://localhost:9200

If it shows something like this congratulations you have successfully started the elasticsearch on your macos. If you are still getting some problem follow this video:

Once you set up Elastic search you need to set up Kibana.

For that open new tab of terminal Command()+T and navigate to

kibana-7.15.1-darwin-x86_64/bin and open

./kibana

Once you see this just go to you browser http://localhost:5601

And Just go to Dev Tools

Now on Dev Tools you will see the Console just clear the content and just type

GET /_cat/health?v

This helps to check if the cluster is running properly or not. If it shows green then it’s running properly. If it shows yellow or red then cluster is not running properly.

Now to add some data to elastic search we use PUT API

PUT /youtube/_doc/1
{
"name":"Arjun Codes"
}

here youtube is the index id and type id _doc and id is 1. So If we run this query we will get the result as.

{
"_index" : "youtube",
"_type" : "_doc",
"_id" : "1",
"_version" : 1,
"result" : "created",
"_shards" : {
"total" : 2,
"successful" : 1,
"failed" : 0
},
"_seq_no" : 0,
"_primary_term" : 1
}

So here data has been successfully added into the elastic search. Now to visualize we the get the same data by providing index id, type and id with GET API.

GET /youtube/_doc/1

So if we put this query we get this kind of output.

{
"_index" : "youtube",
"_type" : "_doc",
"_id" : "1",
"_version" : 1,
"_seq_no" : 0,
"_primary_term" : 1,
"found" : true,
"_source" : {
"name" : "Arjun Codes"
}
}

Now you can explore more about elasticsearch by writing more queries and visualizing more datas. You can refer to the official documentation for more information about elastic search.

Also if you like my blogs help me to buy coffee.

Also don’t forget to follow me on medium and visit my youtube channel:

www.youtube.com/arjuncodes

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store