Elasticsearch Unreachable [Manticore::SocketException] Connection refused

Hi, I have elasticsearch and logstash running on separate servers.
Elasticsearch is up and running, and I'm able to issue a curl command from the server where logstash is installed: curl http://my_ip_address:9200 and I get a successful response.

However, when starting logstash with the following configuration:

input {
     stdin { }
}

output {
    elasticsearch {
        hosts => [ "my_ip_address:9200" ]
    }
}

I get back:
Client::Pool::HostUnreachableError, :error=>"Elasticsearch Unreachable: [http://my_ip_address:9200/][Manticore::SocketException] Connection refused (Connection refused)"}

Using Elasticsearch and Logstash version: 6.5.4

What may be causing the issue?

The issue was solved by passing the proxy value in the configuration file:

input {
     stdin { }
}

output {
    elasticsearch {
        hosts => [ "my_ip_address:9200" ]
        proxy => "http://my_proxy_uri:port"
    }
}