public ElasticSearchRepositories(IElasticClientFactory elasticClientFactory, string elasticClientName = null) { if (elasticClientFactory == null) { throw new ArgumentNullException(nameof(elasticClientFactory)); } ElasticClient = elasticClientFactory.CreateClient(elasticClientName); }
public ApprenticeshipSearchClient(IElasticClientFactory elasticClientFactory, string indexName, ILog logger = null) { _elasticClient = elasticClientFactory.CreateClient(r => logger?.Debug(r.DebugInformation)); _indexName = indexName; _searchFactorConfiguration = GetSearchFactorConfiguration(); _keywordExcludedTerms = new[] { "apprenticeships", "apprenticeship", "traineeship", "traineeships", "trainee" }; _logger = logger; }
public ElasticsearchIndexManager( IElasticClientFactory elasticClientFactory, IIndexFactory indexFactory ) : base(indexFactory) { // Validate parameters. _elasticClient = elasticClientFactory?.CreateClient() ?? throw new ArgumentNullException(nameof(elasticClientFactory)); }
public IReadOnlyCollection <IIndex> CreateIndices() { // Create the client. IElasticClient client = _elasticElasticClientFactory.CreateClient(); // Cycle through the sources, create the indexes. return(_elasticIndexSources .Select(s => s.CreateIndex(client)) .ToReadOnlyCollection()); }
public void Setup() { _elasticClientFactory = Substitute.For <IElasticClientFactory>(); _elasticClient = Substitute.For <IElasticsearchClient>(); _timer = Substitute.For <IIndexingTimer>(); _tolerateCallsFactory = Substitute.For <ITolerateCallsFactory>(); _bulk = Substitute.For <ILogBulkSet>(); _logEventConverterFactory = Substitute.For <ILogEventConverterFactory>(); _logEventConverter = Substitute.For <ILogEventConverter>(); _elasticFilters = new ElasticAppenderFilters(); _fileAccessor = Substitute.For <IFileAccessor>(); _eventWriter = Substitute.For <IExternalEventWriter>(); _elasticClientFactory.CreateClient(null, 0, false, false, null).ReturnsForAnyArgs(_elasticClient); _logEventConverterFactory.Create(FixFlags.All, false).ReturnsForAnyArgs(_logEventConverter); }
public override void ActivateOptions() { AddOptionalServer(); _client = _elasticClientFactory.CreateClient(Servers, ElasticSearchTimeout, Ssl, AllowSelfSignedServerCert, AuthenticationMethod); _logEventConverter = _logEventConverterFactory.Create(FixedFields, SerializeObjects); if (Template != null && Template.IsValid) { if (IndexAsync) { _client.PutTemplateRaw(Template.Name, _fileAccessor.ReadAllText(Template.FileName)); } else { _client.PutTemplateRaw(Template.Name, _fileAccessor.ReadAllText(Template.FileName)); } } ElasticFilters.PrepareConfiguration(_client); _timer.Restart(BulkIdleTimeout); }
public LocationSearchClient(IElasticClientFactory elasticClientFactory, string indexName) { _elasticClient = elasticClientFactory.CreateClient(); _indexName = indexName; }
public static ElasticClient CreateClient(this IElasticClientFactory elasticClientFactory) { return(elasticClientFactory.CreateClient(Microsoft.Extensions.Options.Options.DefaultName)); }
public Task Initialise() { _client = _elasticClientFactory.CreateClient(); return(Task.FromResult(_client)); }
public TraineeshipSearchClient(IElasticClientFactory elasticClientFactory, string indexName, ILog logger = null) { _elasticClient = elasticClientFactory.CreateClient(r => logger?.Debug(r.DebugInformation)); _indexName = indexName; _logger = logger; }