Kibana Unable to revive connection. No living connections

@jarpy Thanks for the reply.
I replaced the localhost with elasticsearch but still no luck.
And the indentation is correct on my side, it just got messed up while pasting. Sorry for that. Here is my updated yml

 version: '3.1'
services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:6.5.4
    container_name: elasticsearch
    environment:
    - cluster.name=docker-cluster
    ports:
    - 9200:9200
    - 9300:9300
  kibana:
    image: docker.elastic.co/kibana/kibana:6.5.4
    environment:
      SERVER_HOST: 0.0.0.0
      ELASTICSEARCH_URL: http://elasticsearch:9300
    ports:
    - "9201:5601"