NEST version 6.2
ElasticSearch version 6.3.2
i have Docker Dev Image and i can access it and insert in the Index by Low level library, but i can not do the same with NEST , below is the code
the error i get "
Invalid NEST response built from a unsuccessful low level call on PUT: /people/person/2
[5] SniffFailure: Node: http://172.17.0.2:9200/ Exception: PipelineException Took: 00:00:21.0067095
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.GetResponse()
at Elasticsearch.Net.HttpConnection.RequestTResponse
--- End of inner exception stack trace ---
at Elasticsearch.Net.RequestPipeline.Sniff()
--- End of inner exception stack trace ---
at Elasticsearch.Net.RequestPipeline.Sniff()
at Elasticsearch.Net.RequestPipeline.SniffOnConnectionFailure()
at Elasticsearch.Net.Transport1.Ping(IRequestPipeline pipeline, Node node)
at Elasticsearch.Net.Transport1.RequestTResponse
--- End of inner exception stack trace ---
Elasticsearch.Net.PipelineException: An error occurred trying to read the response from the specified node. ---> System.Net.WebException: The operation has timed out
at System.Net.HttpWebRequest.GetResponse()
at Elasticsearch.Net.HttpConnection.RequestTResponse
--- End of inner exception stack trace ---
at Elasticsearch.Net.RequestPipeline.Ping(Node node)
Elasticsearch.Net.PipelineException: An error occurred trying to read the response from the specified node. ---> System.Net.WebException: Unable to connect to the remote server ---> 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 172.17.0.2:9200
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.GetResponse()
at Elasticsearch.Net.HttpConnection.RequestTResponse
--- End of inner exception stack trace ---
at Elasticsearch.Net.RequestPipeline.Sniff()
Response:
public class Person
{
public int Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
}
class Program
{
static Uri[] uris = new[]
{
new Uri("http://127.0.0.1:9200") };
static SniffingConnectionPool connectionPool = new SniffingConnectionPool(uris);
static void Main(string[] args)
{
AddDocumentToIndex();
Search1();
Console.WriteLine("Hello World!");
}
static void AddDocumentToIndex()
{
var settings = new ConnectionSettings(connectionPool)
.DefaultIndex("people");
var client = new ElasticClient(settings);
var person = new Person
{
Id = 2,
FirstName = "Martijn2",
LastName = "Laarman2"
};
var indexResponse = client.IndexDocument(person);
//var asyncIndexResponse = await client.IndexDocumentAsync(person);
}
static void Search1()
{
var settings = new ConnectionSettings(connectionPool)
.DefaultIndex("people");
var client = new ElasticClient(settings);
var searchResponse = client.Search<Person>(s => s
.From(0)
.Size(10)
.Query(q => q
.Match(m => m
.Field(f => f.FirstName)
.Query("Martijn")
)
)
);
var people = searchResponse.Documents;
}
}
Very peculiar, you can sniff put not ping the node (HEAD on /).
What happens if you call .DisablePing() on ConnectionSettings ? Do you get a response back then?
It looks like the use of SniffingConnectionPool may be the cause of this. The seeded URI is http://127.0.0.1:9200, but after sniffing, the URI returned is 172.17.0.2:9200, which appears to be an address through which the node cannot be reached. What does
GET _nodes/http,settings
return for the HTTP publish_address?
yes , after i have replace sniffing with connection string with URL it works , thanks alot
Most helpful comment
It looks like the use of
SniffingConnectionPoolmay be the cause of this. The seeded URI ishttp://127.0.0.1:9200, but after sniffing, the URI returned is172.17.0.2:9200, which appears to be an address through which the node cannot be reached. What doesreturn for the HTTP
publish_address?