Пример #1
0
 public Search(ElasticClientProvider elastic)
 {
     client    = elastic.Client;
     IndexName = elastic.Index;
     //var withMaxRecursionDescriptor = new CreateIndexDescriptor(elastic.Index)
     //         .Mappings(ms => ms
     //             .Map<T>(m => m.AutoMap(3))
     //         );
 }
        public void Delete <T>(string field, string value) where T : class
        {
            var response = ElasticClientProvider.GetClient().DeleteByQuery <T>(q => q
                                                                               .Index(NameExtractorService.ExtractName <T>())
                                                                               .Query(qq => qq
                                                                                      .Term($"{field}.keyword", value)
                                                                                      )
                                                                               );

            response.Validate();
        }
Пример #3
0
        public IEnumerable <T> Search <T>(IFilterable filterable) where T : class
        {
            var filters   = filterable.GetFilters();
            var indexName = GetIndexName <T>();
            var query     = GenerateQueryDescriptor(filters);
            var response  = ElasticClientProvider.GetClient().Search <T>(s => s
                                                                         .Index(indexName)
                                                                         .Query(q => query)
                                                                         .Size(5000));

            response.Validate();
            return(GetDocuments(response));
        }
Пример #4
0
 public BulkDataLoadRepository(IHostingEnvironment hostingEnvironment,
                               IOptions <DataFileSettings> dataFileSettings,
                               IOptions <ElasticConnectionSettings> esSettings,
                               DataContext dataContext,
                               ElasticClientProvider provider, ILogger <BulkDataLoadRepository> logger)
 {
     this.hostingEnvironment = hostingEnvironment;
     this.dataFileSettings   = dataFileSettings;
     this.esSettings         = esSettings;
     this.dataContext        = dataContext;
     this.elasticClient      = provider.Client;
     this.logger             = logger;
 }
        public async Task <SearchDTO> GetDocuments(DocumentSearchRequest searchRequest)
        {
            var elasticClient  = ElasticClientProvider.GetElasticClient();
            var searchResponse = await elasticClient.SearchAsync <Document>(s => s
                                                                            .Query(q => q
                                                                                   .MultiMatch(c => c
                                                                                               .Fields(f => f
                                                                                                       .Field(p => p.InvoiceNumber)
                                                                                                       .Field(p => p.InvoiceNumberReverse)
                                                                                                       .Field(p => p.SupplierName)
                                                                                                       .Field(p => p.CompanyName)
                                                                                                       .Field(p => p.OrganizationElementName))
                                                                                               .Query(searchRequest.SearchText)
                                                                                               .Type(TextQueryType.PhrasePrefix)
                                                                                               .Operator(Operator.Or))));

            return(new SearchDTO
            {
                Documents = searchResponse.Documents.ToArray(),
                TotalCount = searchResponse.Total
            });
        }
Пример #6
0
 public SQLEsUserDriver(ElasticClientProvider provider)
 {
     _client = provider.Client;
 }
Пример #7
0
 public SearchService(ElasticClientProvider provider, IMapper mapper)
 {
     _elasticClient = provider.Client;
     _mapper        = mapper;
 }
Пример #8
0
 public ReleaseRepository(ElasticClientProvider clientProvider)
 {
     _elasticClient = clientProvider.Client;
 }
Пример #9
0
 public SearchElasticRepository(ElasticClientProvider provider, ILogger <SearchElasticRepository> logger, IMapper mapper)
 {
     this.elasticClient = provider.Client;
     this.logger        = logger;
     this.mapper        = mapper;
 }
 public ReleaseByIdRepository(ElasticClientProvider clientProvider, IMapper mapper)
 {
     _elasticClient = clientProvider.Client;
     _mapper        = mapper;
 }
Пример #11
0
 public AutoCompleteService(ElasticClientProvider clientProvider)
 {
     _elasticClient = clientProvider.Client;
 }
Пример #12
0
 public AutocompleteService(ElasticClientProvider provider)
 {
     _elasticClient = provider.Client;
 }
Пример #13
0
        public IResponse SendBulk(IEnumerable <T> documents, string indexName)
        {
            var bulk = CreateBulkDescriptor(documents, indexName);

            return(ElasticClientProvider.GetClient().Bulk(bulk));
        }
Пример #14
0
 public SyncService(ElasticClientProvider provider, IMapper mapper, FoodLoversDbContext dbContext)
 {
     _elasticClient = provider.Client;
     _mapper        = mapper;
     _dbContext     = dbContext;
 }
Пример #15
0
 private bool IsIndexExist(string indexName)
 {
     return(ElasticClientProvider.GetClient().Indices.Exists(indexName).Exists);
 }
 public ArtistRepository(ElasticClientProvider clientProvider)
 {
     _elasticClient = clientProvider.Client;
 }
Пример #17
0
 public IndexService(ElasticClientProvider esProvider)
 {
     _esProvider = esProvider;
 }
Пример #18
0
 public UserSearchService(ElasticClientProvider provider,
                          FriendyContext friendyContext)
 {
     _friendyContext = friendyContext;
     _client         = provider.Client;
 }
Пример #19
0
 public ArticleService(ElasticClientProvider esProvider)
 {
     _esProvider = esProvider;
 }
 public SearchService(ElasticClientProvider clientProvider)
 {
     _client = clientProvider.Client;
 }
Пример #21
0
 public SQL2Es(ElasticClientProvider provider)
 {
     _client = provider.Client;
 }
Пример #22
0
 public LogViewRepository(IOptions <ElasticConnectionSettings> elasticSettings, ElasticClientProvider provider)
 {
     this.elasticClient   = provider.Client;
     this.elasticSettings = elasticSettings;
 }
Пример #23
0
 public IResponse CreateIndex(string indexName)
 {
     return(ElasticClientProvider.GetClient().Indices.Create(indexName));
 }