Exemple #1
0
        public ElasticSearchWriter(string connectionString, string index, string type, int retryCount)
        {
            Guard.ArgumentNotNullOrEmpty(connectionString, "connectionString");
            Guard.ArgumentNotNullOrEmpty(index, "index");
            Guard.ArgumentNotNullOrEmpty(type, "type");
            Guard.ArgumentGreaterOrEqualThan(1, retryCount, "retryCount");

            if (Regex.IsMatch(index, "[\\\\/*?\",<>|\\sA-Z]"))
            {
                throw new ArgumentException(Resource.InvalidElasticsearchIndexNameError, "index");
            }

            _index            = index;
            _type             = type;
            _elasticsearchUrl = new Uri(new Uri(connectionString), BulkServiceOperationPath);
            _retryPolicy      = RetryPolicyFactory.MakeHttpRetryPolicy(retryCount);
        }