how are you running Elasticsearch e.g. from zip, package, Docker?
how are your running the .NET client application e.g. on Windows, MacOS, Linux, in Docker?
version of .NET you are running e.g. .NET full framework, .NET Core? Version?
It's a SocketException coming from the underlying HTTP library attempting to connect to localhost on port 9200, which says to me this is likely a network configuration issue.
Im in windows 10 machine, but my .net is in asp.net core 3.0 via docker.
.net core 3.0
If I am not running my .net app in the same docker network with elasticsearch I can be able to connect.
var settings = new ConnectionSettings(new Uri("http://localhost:9200"))
.DefaultIndex("simplecustomer");
settings.BasicAuthentication("elastic", "changeme");
var client = new ElasticClient(settings);
var asyncIndexResponse = await client.IndexDocumentAsync(customer);
but once I use docker to run my .net.. i cant be able to connect.
Im thinking that its because of http://localhost:9200, but changing it to elasticsearch name defined in docker-compose, its complaining that it cannot read the supplied uri.
var settings = new ConnectionSettings(new Uri("elasticsearch "))
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.