BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery().filter(QueryBuilders.termQuery( filterField, tenantCode)); MaxAggregationBuilder aggData = AggregationBuilders.max("aggData").field(field); SearchQuery searchQuery = new NativeSearchQueryBuilder() .withIndices(index) .withTypes("_doc") .withQuery(boolQueryBuilder) .addAggregation(aggData) .build(); Aggregations query = elasticsearchRestTemplate.query(searchQuery, SearchResponse::getAggregations); ParsedMax aggregation = (ParsedMax) query.asList().get(0);
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)