springboot ElasticsearchRepository date_histogram 聚合查询
NativeSearchQueryBuilder nsqb = new NativeSearchQueryBuilder(); DateHistogramAggregationBuilder dhb = AggregationBuilders.dateHistogram("passenger_flow").field("timeString") .dateHistogramInterval(DateHistogramInterval.DAY) .minDocCount(0) .format("yyyy-MM-dd") .extendedBounds(new ExtendedBounds("2023-02-10", "2023-02-16")); nsqb.addAggregation(dhb); //查询对象 SearchQuery queryBuilder = nsqb.build(); Iterable<ExtCallbackStatisticsES> aIterable = extCallbackStatisticsESMapper.search(queryBuilder);
extCallbackStatisticsESMapper.search(queryBuilder);