I am new to elastic search and I have created a 3 node elastic search cluster in Microsoft Azure using the "Elastic Stack" template. But I am not able to connect to the cluster using connection pool or using a single node connection.
Here's my code:
var uris = new[]
{
new Uri("http://<>:9200")
};
var connectionPool = new SniffingConnectionPool(uris);
var settings = new ConnectionSettings(connectionPool)
.SniffOnConnectionFault(false)
.SniffOnStartup(false)
.RequestTimeout(TimeSpan.FromSeconds(500))
.PingTimeout(TimeSpan.FromSeconds(500))
.MaximumRetries(5)
.DefaultIndex("people");
var client = new ElasticClient(settings);
It gives me the error:
FailureReason: PingFailure while attempting PUT on http://<>:9200/people/person/1
Audit trail of this API call:
OriginalException: 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 10.0.2.4: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.Request[TReturn](RequestData requestData)
Request:
<Request stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.>
Response:
<Response stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.>
Inner Exception: One or more errors occurred.
System.AggregateException: One or more errors occurred. ---> Elasticsearch.Net.PipelineException: Failed to ping the specified node. ---> Elasticsearch.Net.PipelineException: An error occurred trying to read the response from the specified node.
at Elasticsearch.Net.RequestPipeline.Ping(Node node)
--- End of inner exception stack trace ---
at Elasticsearch.Net.RequestPipeline.Ping(Node node)
at Elasticsearch.Net.Transport1.Ping(IRequestPipeline pipeline, Node node) at Elasticsearch.Net.Transport
1.Request[TReturn](HttpMethod method, String path, PostData1 data, IRequestParameters requestParameters) --- End of inner exception stack trace --- ---> (Inner Exception #0) Elasticsearch.Net.PipelineException: Failed to ping the specified node. ---> Elasticsearch.Net.PipelineException: An error occurred trying to read the response from the specified node. at Elasticsearch.Net.RequestPipeline.Ping(Node node) --- End of inner exception stack trace --- at Elasticsearch.Net.RequestPipeline.Ping(Node node) at Elasticsearch.Net.Transport
1.Ping(IRequestPipeline pipeline, Node node)
at Elasticsearch.Net.Transport1.Request[TReturn](HttpMethod method, String path, PostData
1 data, IRequestParameters requestParameters)<---
Exception:
Elasticsearch.Net.ElasticsearchClientException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> Elasticsearch.Net.PipelineException: Failed to ping the specified node. ---> Elasticsearch.Net.PipelineException: An error occurred trying to read the response from the specified node.
at Elasticsearch.Net.RequestPipeline.Ping(Node node)
--- End of inner exception stack trace ---
at Elasticsearch.Net.RequestPipeline.Ping(Node node)
at Elasticsearch.Net.Transport1.Ping(IRequestPipeline pipeline, Node node) at Elasticsearch.Net.Transport
1.Request[TReturn](HttpMethod method, String path, PostData`1 data, IRequestParameters requestParameters)
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
Any suggestions , what I could be missing?