public void GetProductByPrefixKeyword() { var request = new ProductSearchRequest { Keyword = "MAMA" }; var result = helper.SearchByPrefixKeyword(request); }
public PagedResponse<ProductDoc> SearchByPrefixKeyword(ProductSearchRequest request) { QueryContainer filter = null; var query = new QueryBuilder() .AndPrefixMatch("name_NA", request.Keyword) .Build(); var categoryAgg = new AggregationContainerDescriptor<ProductDoc>() .Terms("agg_name", f => f.Field("name_NA").Size(5)); var result = Client.SetPageNum(1).SetPageSize(0).SearchResponse(query, filter, a => categoryAgg); return Client.WrapResult(result); }