Logstash sending it's metric data to elasticsearch in localhost instead of configured host

I found the proper way to configure the logstash.yml for logstash(x-pack) here