Ejemplo n.º 1
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));
            }
        }
Ejemplo n.º 2
0
        public async Task <bool> PostDeleteDocumentElasticIndex(PostElasticIndexDto postElasticIndexDto)
        {
            try
            {
                await _elasticSearchService.DeleteAsync <PostElasticIndexDto, int>(
                    ElasticSearchItemsConst.PostIndexName,
                    "postelasticindexdto",
                    postElasticIndexDto
                    );

                return(true);
            }
            catch (Exception ex)
            {
                return(await Task.FromException <bool>(ex));
            }
        }
 private async void PostAddOrUpdateElasticIndex(PostElasticIndexDto postElastic)
 {
     await _postService.PostAddOrUpdateElasticIndex(postElastic);
 }