public ElasticClientProvider( ILogger <IElasticClientProvider> logger, IConfiguration config, IElasticClientFactory elasticClientFactory, ElasticConnection connection) { this.elasticClientFactory = elasticClientFactory; this.logger = logger; this.connection = connection; // Reading credentials from IConfiguration directly allows to have credentials be stored either // in the appsettings file (for development), or in the environment variables (for staging/production). this.readerUsername = config.GetValue <string>("ES_READER_USERNAME"); this.readerPassword = config.GetValue <string>("ES_READER_PASSWORD"); this.writerUsername = config.GetValue <string>("ES_WRITER_USERNAME"); this.writerPassword = config.GetValue <string>("ES_WRITER_PASSWORD"); var missingValues = string.Join( "/", new[] { this.readerUsername == null ? "Reader Username" : null, this.readerPassword == null ? "Reader Password" : null, this.writerUsername == null ? "Writer Username" : null, this.writerPassword == null ? "Writer Password" : null }.Where(x => x != null)); if (!string.IsNullOrEmpty(missingValues)) { var exception = new ElasticConnectionException(missingValues); this.logger.LogWarning(exception.Message); throw exception; } }
public ElasticSearchAppender(IElasticClientFactory clientFactory, LogEventSmartFormatter indexName, LogEventSmartFormatter indexType, IIndexingTimer timer, ITolerateCallsFactory tolerateCallsFactory, ILogBulkSet bulk, ILogEventConverterFactory logEventConverterFactory, ElasticAppenderFilters elasticFilters, IFileAccessor fileAccessor, IExternalEventWriter eventWriter) { _logEventConverterFactory = logEventConverterFactory; _elasticClientFactory = clientFactory; IndexName = indexName; IndexType = indexType; _timer = timer; _timer.Elapsed += (o, e) => DoIndexNow(); _tolerateCallsFactory = tolerateCallsFactory; _bulk = bulk; _fileAccessor = fileAccessor; _eventWriter = eventWriter; FixedFields = FixFlags.Partial; SerializeObjects = true; BulkSize = 2000; BulkIdleTimeout = 5000; DropEventsOverBulkLimit = false; TotalDropEventLimit = null; TimeoutToWaitForTimer = 5000; ElasticSearchTimeout = 10000; IndexAsync = true; Template = null; AllowSelfSignedServerCert = false; Ssl = false; _tolerateCalls = _tolerateCallsFactory.Create(0); Servers = new ServerDataCollection(); ElasticFilters = elasticFilters; AuthenticationMethod = new AuthenticationMethodChooser(); IndexOperationParams = new IndexOperationParamsDictionary(); }
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 ElasticSearchRepositories(IElasticClientFactory elasticClientFactory, string elasticClientName = null) { if (elasticClientFactory == null) { throw new ArgumentNullException(nameof(elasticClientFactory)); } ElasticClient = elasticClientFactory.CreateClient(elasticClientName); }
public IndexManager(IMemoryCache memoryCache, IElasticClientFactory elasticClientFactory, ILogger <IndexManager> logger) { _memoryCache = memoryCache; _logger = logger; _elasticClient = elasticClientFactory.Create(); Console.WriteLine("ElasticsearchIndex初始化"); }
public ElasticsearchIndexManager( IElasticClientFactory elasticClientFactory, IIndexFactory indexFactory ) : base(indexFactory) { // Validate parameters. _elasticClient = elasticClientFactory?.CreateClient() ?? throw new ArgumentNullException(nameof(elasticClientFactory)); }
public ElasticIndexFactory(IElasticClientFactory elasticClientFactory, IEnumerable <IElasticIndexSource> elasticIndexSources) { // Validate parameters _elasticElasticClientFactory = elasticClientFactory ?? throw new ArgumentNullException(nameof(elasticClientFactory)); _elasticIndexSources = elasticIndexSources?.ToReadOnlyCollection() ?? throw new ArgumentNullException(nameof(elasticIndexSources)); }
private static IndexName _IndexName = "serviceoperationmodel";//IndexName.From<ServiceOperationModel>(); public ServcieOperationService(IMemoryCache memoryCache, IElasticClientFactory elasticClientFactory, ILogger <ServcieOperationService> logger) { MemoryCache = memoryCache; ElasticClient = elasticClientFactory.Get(); Logger = logger; TryCreateIndex(); }
public VkMessageService( IElasticClientFactory elasticClientFactory, ITransactionScopeFactory transactionScopeFactory, MessagePredicting.MessagePredictingClient messagePredictingClient, ILogger <VkMessageService> logger ) { _elasticClientFactory = elasticClientFactory; _transactionScopeFactory = transactionScopeFactory; _messagePredictingClient = messagePredictingClient; _logger = logger; }
public SpanService(IMemoryCache memoryCache, IElasticClientFactory elasticClientFactory, ILogger <SpanService> logger, IOptions <ElasticsearchOption> tracingTPLPipelineOption, IMapper mapper) { MemoryCache = memoryCache; ElasticClient = elasticClientFactory.Get(); Logger = logger; _TracingTPLPipelineOption = tracingTPLPipelineOption; _Mapper = mapper; }
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 ElasticSearchEventListener(IElasticClientFactory factory) { this.factory = factory; this.indexedTypes = new HashSet<Type>(); }
public ElasticsearchServiceStorage(IElasticClientFactory elasticClientFactory, IIndexManager indexManager, IMemoryCache memoryCache) { _elasticClient = elasticClientFactory?.Create() ?? throw new ArgumentNullException(nameof(elasticClientFactory)); _indexManager = indexManager ?? throw new ArgumentNullException(nameof(indexManager)); _memoryCache = memoryCache ?? throw new ArgumentNullException(nameof(memoryCache)); }
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 PingElasticsearchStep(IElasticClientFactory <TConnection> connection) { _clientFactory = connection; }
public GlobalElasticSearchRepository(IElasticClientFactory elasticClientFactory) : base(elasticClientFactory, Options.DefaultName) { }
public ElasticSearchAppender(IElasticClientFactory elasticClientFactory) { _elasticClient = elasticClientFactory?.ESClient ?? throw new ArgumentNullException(nameof(elasticClientFactory)); }
public ElasticDbStore(IElasticClientFactory elasticClientFactory) { _elasticClientFactory = elasticClientFactory; }
public TestLocationSearchClient(IElasticClientFactory factory) : base(factory, null) { }
public IndexManager(IMemoryCache memoryCache, IElasticClientFactory elasticClientFactory, ILogger <IndexManager> logger) { _memoryCache = memoryCache; _logger = logger; _elasticClient = elasticClientFactory.Create(); }
public ElasticsearchSpanStorage(IElasticClientFactory elasticClientFactory, IIndexManager indexManager) { _elasticClient = elasticClientFactory?.Create() ?? throw new ArgumentNullException(nameof(elasticClientFactory)); _indexManager = indexManager ?? throw new ArgumentNullException(nameof(indexManager)); }
public QueryRepository(IElasticClientFactory factory) { this.factory = factory; }
public IndexManager(IElasticClientFactory elasticClientFactory) { _elasticClientFactory = elasticClientFactory; }
public ElasticSearchEventListener(IElasticClientFactory factory) { this.factory = factory; this.indexedTypes = new HashSet <Type>(); }
public ElasticSearchServiceQuery(IElasticClientFactory elasticClientFactory, IIndexManager indexManager) { _indexManager = indexManager; _elasticClient = elasticClientFactory.Create(); }
public TraineeshipSearchClient(IElasticClientFactory elasticClientFactory, string indexName, ILog logger = null) { _elasticClient = elasticClientFactory.CreateClient(r => logger?.Debug(r.DebugInformation)); _indexName = indexName; _logger = logger; }