Failed to connect to server_name:9200 connection refused

Hi,
I am using elastic search 7.3.1 in windows server 2012. I am able to use all functionalities in the localhost, but I want to access es outside of the server. I am having the IP and port configuration in the elasticsearch.yml. But it still going to the localhost(127.0.0.1) only and also I gave access to the port 9200 in the firewall. So I am not sure why still it is pointing to localhost. Can someone help to fix this issue?

My elasticsearch.yml contains
transport.host: serverip
transport.tcp.port: 9300
http.port: 9200
network.host: serverip

Thanks

One possible reason is that you haven't restarted Elasticsearch after changing the config. Can you confirm you've restarted it?

If it still doesn't work, you can check what port it's really listening on. What does netstat -an | findstr 9200 return? It should show serverip:9200 if your config is working rather than 127.0.0.1.

Beyond that there could be a number of network configuration problems preventing you from accessing serverip:9200 even though ES is actually listening on it.