介绍, searchGroupChenQ (List,关键字),{
,,,,,,,String key =,“tid";
,,,,,,,String [], strings =, new 字符串(keywords.size ());
,,,,,,,keywords.toArray(字符串);
,,,,,,,SearchSourceBuilder bulder =, new SearchSourceBuilder ();
,,,,,,,BoolQueryBuilder should =, QueryBuilders.boolQuery () .must (QueryBuilders.termsQuery (“content",,关键字))
,,,,,,,,,,,,,,,.must (QueryBuilders.termsQuery (“tid",, tid));
,,,,,,,bulder.query(应该);
,,,,,,,IncludeExclude IncludeExclude =, new IncludeExclude(字符串、,null);
,,,,,,,TermsAggregationBuilder agg =, AggregationBuilders.terms (“tids") .field(关键)
,,,,,,,,,,,,,,,.subAggregation (AggregationBuilders.terms (“keywords") .field (“content") .includeExclude (includeExclude)
,,,,,,,,,,,,,,,,,,,,,,,.subAggregation (AggregationBuilders.topHits (“topHits")
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.fetchSource (new String [] {“tid",,“tname",,“dname"},, new String [] {“did",,“title",,“cityid",,“cityName",,“content",,“createDate"})
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.size (5)));
,,,,,,,bulder.aggregation (gg) .size (0);
,,,,,,,List, value =, baseElasticService.searchGroupChenQ (“notice_info_new",,电珠);
,,,,,,,return 价值;
,,,}
,,,public List, searchGroupChenQNew (List,关键字),{
,,,,,,,String key =,“tid";
,,,,,,,String [], strings =, new 字符串(keywords.size ());
,,,,,,,keywords.toArray(字符串);
,,,,,,,SearchSourceBuilder bulder =, new SearchSourceBuilder ();
,,,,,,,BoolQueryBuilder should =, QueryBuilders.boolQuery () .must (QueryBuilders.termsQuery (“content",,关键字))
,,,,,,,,,,,,,,,.must (QueryBuilders.termsQuery (“tid",, tid));
,,,,,,,bulder.query(应该);
,,,,,,,IncludeExclude IncludeExclude =, new IncludeExclude(字符串、,null);
,,,,,,,TermsAggregationBuilder agg =, AggregationBuilders.terms (“tids") .field(关键)
,,,,,,,,,,,,,,,.subAggregation (AggregationBuilders.terms (“keywords") .field (“content") .includeExclude (includeExclude)
,,,,,,,,,,,,,,,,,,,,,,,.subAggregation (AggregationBuilders.topHits (“topHits")
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.fetchSource (new String [] {“tid",,“tname",,“dname"},, new String [] {“did",,“title",,“cityid",,“cityName",,“content",,“createDate"})
null
null
null
null
null
本篇内容介绍了“java中的ES操作语法分组”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
<>之前,,,,public List