public ISearchResponse <Document> SearchForAllWords(string wordsWithPlusSign, string wordsWithMinusSign, string noneSignWords) { var response = client.Search <Document>(s => s .Index(index) .Size(1000) .Query(q => q .Bool(b => b .Must(must => must .Match(match => match .Field(d => d.Text) .Query(noneSignWords) .MinimumShouldMatch(noneSignWords.Split(" ").Length)) , must => must .Match(match => match .Field(d => d.Text) .Query(wordsWithPlusSign) )) .MustNot(must => must .Match(match => match .Field(p => p.Text) .Query(wordsWithMinusSign))) ))); ResponseValidator.handleValidation(response, queryResponceString); return(response); }
public void BulkDocs <T>(List <T> documents) where T : class { var bulkDescriptor = new BulkDescriptor(); foreach (var doc in documents) { bulkDescriptor.Index <T>(x => x .Index(index) .Document(doc) ); } ResponseValidator.handleValidation(client.Bulk(bulkDescriptor), TOPIC_OF_BULKING_DOCS_REQUEST); }
public void CreateMapping() { var response = client.Indices.Create(index, c => c .Map <Document>(m => m.AutoMap() .Properties(pps => pps .Number(s => s .Name(e => e.Id)) .Text(t => t .Name(n => n.Text) .Analyzer("whitespace") .Analyzer("lowercase"))))); ResponseValidator.handleValidation(response, TOPIC_OF_CEARTING_INDEX_REQUEST); }