示例#1
0
 private static ElasticClient CreateElasticClient(IClientSettings settings)
 {
     var uris = settings.ConnectionPool.Select(a => new Uri(a));
     var connectionPool = new SniffingConnectionPool(uris);
     var connectionSettings = new ConnectionSettings(connectionPool,settings.DefaultIndex);
     if(settings.Authorization != null) connectionSettings.SetBasicAuthentication(settings.Authorization.Username, settings.Authorization.Password);
     return new ElasticClient(connectionSettings);
 }