I am trying to connect to Elasticsearch from another machine in C# code. I specified the Elasticsearch host machine's fully qualified domain name in the uri and tried to connect with something like the following:
Uri elasticsearchUri = new Uri("http://foo.bar.local:9200");
var settings = new ConnectionSettings(elasticsearchUri).DefaultIndex("MyIndex");
var client = new ElasticClient(settings);
var indexResponse = elasticClient.Index(data);
I got the following when executing the last line:
System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it <IP address of ES host machine>:9200
In addition, the ES is hosted on a Windows Server 2012R2 virtual server. I have turned off all its firewalls. Should I unblock the connection of certain app or feature for the remote ES connection to work?
Please advise what I need to do with this. We just installed ElasticSearch and everything should be the latest.