Elastic Search listening only on IPv6 [CentOS]

From unix exchange.

This is happening because by default, AF_INET6 sockets will actually work for both IPv4 and IPv6. See section 3.7 - Compatibility with IPv4 Nodes of RFC 3493 - Basic Socket Interface Extensions for IPv6

But as you've figured out, firewalld is enabled out of the box.

create this file to your /etc/firewalld/services/elasticsearch.xml

<?xml version="1.0" encoding="utf-8"?>
  <description>Elasticsearch is a distributed, open source search and analytics engine, designed for horizontal scalability, reliability, and easy management.</description>
  <port protocol="tcp" port="9300"/>
  <port protocol="tcp" port="9200"/>

Update permissions

chmod 0400 /etc/firewalld/services/elasticsearch.xml
chown root: /etc/firewalld/services/elasticsearch.xml

Run these commands

firewall-cmd --zone=public --add-service=elasticsearch --permanent
firewall-cmd --reload