elastic查询笔记(1)

组装查询条件时:

1.中文不分词

  boolQueryBuilder.must(new MatchQueryBuilder("productName", request.get("name")).type(MatchQueryBuilder.Type.PHRASE));
   

2.子嵌套        

 boolQueryBuilder.must(new NestedQueryBuilder("bookCityCode",new TermQueryBuilder("bookCityCode.code", request.get("bookCityCode"))));

boolQueryBuilder.must(new NestedQueryBuilder("bookCityCalendar.saleCalendar",new RangeQueryBuilder("bookCityCalendar.saleCalendar.departDate").gte(startDate).lte(endDate)));


3.数组list

 boolQueryBuilder.must(new TermsQueryBuilder("brandId", brandList));


4.范围

boolQueryBuilder.must(new RangeQueryBuilder("totalDayNum").from(dateMin).to(dateMax));


你可能感兴趣的:(Elasticsearch)