-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
NEST/Elasticsearch.Net version: 6.8.9
Elasticsearch version: 6.8.23
Description of the problem including expected versus actual behavior:
We are having issue with the following exception being thrown:
Elasticsearch.Net.UnexpectedElasticsearchClientException: No nodes were attempted, this can happen when a node predicate does not match any nodes
---> Elasticsearch.Net.ElasticsearchClientException: No nodes were attempted, this can happen when a node predicate does not match any nodes
--- End of inner exception stack trace ---
What I have gathered:
- It happens on multiple customers. Some experience this multiple times a week.
- Seems to happen more on customers with heavy traffic
- It recovers by itself
- Issue has been occurring across multiple versions on 6.8.x (NEST and elastic)
- The exception is thrown by multiple code paths. When it has recovered, the same code path, with the same query will succeed.
- Happens across clusters
I recently thought that the issue could be that we were creating excessive amounts of ElasticClient's, but to my surprise the issue worsened when I moved to a singleton pattern.
We are using SniffingConnectionPool and most are connected to 3 nodes (2 data and one arbiter). The elasticsearch servers are running in Azure on windows. Client is also running in Azure.
ElasticClient creation:
private ElasticClient CreateElasticClient(string connectionString, ElasticOptions elasticOptions)
{
var useElastic = elasticOptions?.Use ?? false;
var debugElastic = elasticOptions?.Debug ?? false;
if (!useElastic || string.IsNullOrWhiteSpace(connectionString))
return null;
var connectionStrings = connectionString.SplitList(';', ',', '|');
var nodes = connectionStrings.Select(conn => new Uri(conn)).ToArray();
var connection = new HttpConnection();
var connectionPool = new SniffingConnectionPool(nodes);
var connectionSettings = new ConnectionSettings(connectionPool, connection, sourceSerializer: (builtin, settings) =>
new ElasticSearchJsonSerializer(builtin, settings));
var nodeWithUserInfo = nodes.FirstOrDefault(x => !string.IsNullOrWhiteSpace(x.UserInfo));
if (nodeWithUserInfo != null)
{
var userInfo = nodeWithUserInfo.UserInfo.Split(':');
connectionSettings.BasicAuthentication(userInfo.First(), userInfo.Last());
}
connectionSettings.DefaultFieldNameInferrer(p => p); // Prevents lowercasing of property names
if (debugElastic)
{
connectionSettings.EnableDebugMode(details =>
{
_logger.LogDebug(details.DebugInformation);
});
}
return new ElasticClient(connectionSettings);
}
}
Basically, I require assistance in what could be causing this exception to be thrown.
Steps to reproduce:
Unable to reproduce in controlled environment. But seems to happen when there is a lot of queries happening.
Provide ConnectionSettings
(if relevant):
Example connection string (not accessible outside Azure): "connectionString": "http://search01a-noe:9200;http://search01b-noe:9200"