コード例 #1
0
        public async Task Execute(IJobExecutionContext context)
        {
            await _elasticSearchService.CreateIndexAsync <VProductAndDescription>("yenijob", "yenijobalias");

            var list = _context.VProductAndDescription.ToList();

            _elasticSearchService.BulkIndex <VProductAndDescription>("yenijob", list);
        }
コード例 #2
0
        public async Task <bool> CreateIndexes(ProductElasticIndexDto productElasticIndexDto)
        {
            try
            {
                await _elasticSearchService.CreateIndexAsync <ProductElasticIndexDto, int>(ElasticSearchItemsConst.ProductIndexName);

                await _elasticSearchService.AddOrUpdateAsync <ProductElasticIndexDto, int>(ElasticSearchItemsConst.ProductIndexName, productElasticIndexDto);

                return(await Task.FromResult <bool>(true));
            }
            catch (Exception ex)
            {
                return(await Task.FromException <bool>(ex));
            }
        }
コード例 #3
0
        public async Task <bool> PostAddOrUpdateElasticIndex(PostElasticIndexDto postElasticIndexDto)
        {
            try
            {
                // Her ekleme işleminde daha önce Index oluşturulup oluşturulmadığını kontrol ediyoruz.
                await _elasticSearchService.CreateIndexAsync <PostElasticIndexDto, int>(ElasticSearchItemsConst.PostIndexName);

                // Yeni bir elasticindex kayıt ekliyoruz(Document)
                await _elasticSearchService.AddOrUpdateAsync <PostElasticIndexDto, int>(ElasticSearchItemsConst.PostIndexName, postElasticIndexDto);

                return(await Task.FromResult <bool>(true));
            }
            catch (Exception ex)
            {
                return(await Task.FromException <bool>(ex));
            }
        }