C#弹性搜索连接池实现面临问题

时间:2016-06-10 08:47:24

标签: nest

错误:“对HEAD上的不成功低级别调用构建的无效NEST响应:步骤2中的审计异常PingFailure:\ r \ nElasticsearch.Net.PipelineException:尝试与指定节点建立连接时发生错误。\ r \ n \ n“

private static ElasticClient GetESClient(Uri[] nodes, string username, string password)
        {
           var connectionPool = new SniffingConnectionPool(nodes);
            var setting = new ConnectionSettings(connectionPool)
                               .SniffOnConnectionFault(false)
                               .SniffOnStartup(false)
.SniffLifeSpan(TimeSpan.FromMinutes(1)).DisableDirectStreaming()
                               .BasicAuthentication(username, password)
                               .MaximumRetries(5);
setting.DefaultIndex(ConfigurationManager.AppSettings["ElasticSearch_val"].ToString());
            var esClient = new ElasticClient(setting);
            return esClient;
        }

0 个答案:

没有答案