By default elastic search is listening on ipv6 and not ipv4 when installed .
We can make it listen on on ipv4 by adding this line
network.host: _non_loopback:ipv4_ to /etc/elasticsearch/elasticsearch.yml configuration file .
Or we can disable ipv6 at Operating system level by adding below lines to /etc/sysctl.conf file
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
We can restart the server or just sudo sysctl -p to activate the changes