private ElasticAsyncCollector CreateElasticAsyncCollector(ElasticAttribute attribute)
        {
            var elasticUrl = string.IsNullOrEmpty(attribute.ElasticUrl) ? _options.ElasticUrl : attribute.ElasticUrl;
            var userName   = string.IsNullOrEmpty(attribute.UserName) ? _options.UserName : attribute.UserName;
            var password   = string.IsNullOrEmpty(attribute.Password) ? _options.Password : attribute.Password;

            var connectionPool = new SingleNodeConnectionPool(new Uri(elasticUrl));
            var settings       = new ConnectionSettings(connectionPool, sourceSerializer: JsonNetSerializer.Default)
                                 .BasicAuthentication(userName, password); // TODO - look at how to support different auth types

            var client = new ElasticClient(settings);                      // TODO - should this be cached?

            return(new ElasticAsyncCollector(client, attribute));
        }
 public ElasticAsyncCollector(ElasticClient client, ElasticAttribute a)
 {
     _client    = client;
     _attribute = a;
 }
 private void ElasticAttributeValidator(ElasticAttribute attribute, Type type)
 {
     // TODO validate connection details exist or throw exception
     // TODO validate that Index is set (also IndexType?)
 }