Пример #1
0
        private async Task <Nest.IElasticClient> CreateESClient <T>(string name = "")
        {
            var result = await _ESFactory.CreateClient <T>(TABLE_NAME, name);

            if (_initializedIndices.TryAdd(TABLE_NAME, true))
            {
                await CreateReportIndicMapping(result);
            }
            return(result);
        }
        public async Task <Nest.IElasticClient> CreateClient(string name)
        {
            var result = await _clientFactory.CreateClient(await GetIndexName(name));

            if (_initializedIndices.TryAdd(name, true))
            {
                await CreateRankedScoreMapping(result);
            }
            return(result);
        }
Пример #3
0
        public async Task <Nest.IElasticClient> CreateClient(string historyType = "")
        {
            var result = await _clientFactory.CreateClient <GameHistoryRecord>(_databaseName, historyType);

            if (_initializedIndices.TryAdd("", true))
            {
                await CreateGameHistoryMapping(result);
            }
            return(result);
        }
Пример #4
0
        public async Task <object> OnMergedUsers(IEnumerable <User> deletedUsers, User mergeResult)
        {
            var client = await _client.CreateClient(_indexName);

            var profiles = await client.SearchAsync <PlayerProfile>(desc => desc.Query(q => q.Terms(tq => tq
                                                                                                    .Terms(deletedUsers.Select(u => u.Id))
                                                                                                    .Field(p => p.PlayerId)
                                                                                                    )));

            return(profiles.Documents.ToList());
        }
Пример #5
0
        private async Task <Nest.IElasticClient> Client()
        {
            var client = await _clientFactory.CreateClient(_indexName);

            if (!_mappingChecked)
            {
                using (await _mappingCheckedLock.LockAsync())
                {
                    if (!_mappingChecked)
                    {
                        _mappingChecked = true;
                        await CreateUserMapping();
                    }
                }
            }
            return(client);
        }
Пример #6
0
        public async Task Flush()
        {
            var index = await GetIndexName();



            var client = await _cFactory.CreateClient(index);

            Document doc;

            _buffer.Clear();
            var docCount = 0;

            while (_documents.TryDequeue(out doc))
            {
                ++docCount;
                _buffer.AppendLine($"{{\"index\":{{ \"_type\":\"{doc.Type}\"}}}}");
                _buffer.AppendLine(doc.Content);
            }
            if (docCount > 0)
            {
                var r = await client.LowLevel.BulkAsync <object>(index, _buffer.ToString());
            }
        }
 public InAppNotificationRepository(ILogger logger, IESClientFactory clientFactory)
 {
     _logger = logger;
     _client = clientFactory.CreateClient <InAppNotificationRecord>(INDEX_NAME);
 }
        /// <summary>
        /// Tools function where i create/get current elastic search client
        /// </summary>
        /// <param name="index">Index name</param>
        /// <returns></returns>
        private async Task <Nest.IElasticClient> CreateClient <T>(string assetType = "")
        {
            var result = await _elasticClient.CreateClient <T>(DATABASE_NAME, assetType);

            return(result);
        }
Пример #9
0
        private async Task <Nest.IElasticClient> CreateESClient(string type, string param = "")
        {
            var result = await _cFactory.CreateClient(type, TABLE_NAME, param);

            return(result);
        }
 private Task <IElasticClient> GetClient()
 {
     return(_factory.CreateClient(_index));
 }
Пример #11
0
        private async Task <Nest.IElasticClient> CreateESClient <T>(string parameters)
        {
            var result = await _esClient.CreateClient <T>(TABLE_NAME, parameters);

            return(result);
        }