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.
network.host:["<IP address of the ES host machine>", "<Fully qualified domain name of the ES host machine>", "_local_"]
However, I got a slightly different error:
System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond <IP address of the ES host machine>:9200
I am able to connect and index into ES locally with http://localhost:9200 as the uri though. Is my syntax of the array for network.host wrong or something? Do I need to restart the host machine for the new network.host value to take effect?
In addition, the ES is hosted on a Windows Server 2012R2 virtual server. I have turned off all its firewalls. Should I unblock a specific app or feature to be able to connect to the ES remotely?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.