Setup and test elasticsearch quickly

backend2 Min to Read08 Aug 20

If you are using elasticsearch for the first time, then you might be thinking on how to setup elasticsearch quickly. In this post, we will learn how to setup elasticsearch and kibana using docker.

Make sure docker is already installed on your system, if not follow this link to install docker.

Quickly setup and test elasticsearch

Quickly run single node cluster using docker. Port 9200 is for Rest API and 9300 is for other node communication.

docker run --name myelastic -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node"

Test if elasticsearch is running using below curl command, it should successfully return node details.

curl -X GET "localhost:9200/_cat/nodes?v&pretty"

Quickly setup kibana

Kibana is open source data visualization tool for elasticsearch but it also provide query builder interface through which you can run various query against elasticsearch. Its Query builder interface provide auto completion.

docker run --link myelastic:elasticsearch -p 5601:5601

After successfull start, open http://localhost:5601/ to view kibana user interface.

Elasticsearch and Kiban with docker-compose

If you want to start multiple service with docker then it better to use docker-compose instead of docker command line.

Paste below code in docker-compose.yaml file and run docker-compose up to start elasticsearch and kibana.

version: "3.8"
    container_name: elasticsearch-dc
      - "9200:9200"
      - "9300:9300"
      - discovery.type=single-node

    container_name: kibana-dc
      - "5601:5601"
      - "elasticsearch:elasticsearch"
      - elasticsearch


Install Kiban with docker
Install Elasticsearch with docker

If you loved this post, Please share it on social media.