I am using ElasticSearch.NET and NEST to service calls to a .NET webservice. The ElasticClient is a singleton so that its connection pooling and failover should be persisted between service calls.
The ElasticClient is using a SniffingConnectionPool with two clustered nodes. One of the two nodes is dead and not responding to http traffic at all.
My understanding is that the SniffingConnectionPool should detect this and exclude the dead connection from the nodes that it uses - that is, all Elasticsearch traffic should be sent to the sole live node.
Sadly, the ElasticClient persists in attempting to use the dead node, adding long timeout delays to the webservice response. Has anybody had any success using the Elasticsearch.NET failover pooling? Does anyone have any ideas what I am doing wrong, or what else I could try?
I have already tried switching to a StaticConnectionPool, but the problem persisits.
I have tried futzing with the connection settings, but can't really get a useful enough understanding from the doco at http://nest.azurewebsites.net/elasticsearch-net/cluster-failover.html.
Here's the code that I use to create the client with its connection pool:
private static IElasticClient _MakeClient(string[] injectedUris, string defaultIndex)
{
var settings = new ConnectionSettings(_GetIConnectionPool(injectedUris), defaultIndex);
var connection = new ConnectionWithBackoffStrategy(
new HttpConnection(settings));
var client = new ElasticClient(settings, connection);
return client;
}
private static IConnectionPool _GetIConnectionPool(string[] injectedUris)
{
var uris = injectedUris ?? ConfigurationManager.AppSettings["elasticSearchUrls"].Split(',');
return new SniffingConnectionPool(uris.Select(uri => new Uri(uri)));
}
I'm using Nest 1.0.0-beta1.