Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

spring data elasticsearch aggregation max

SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
sourceBuilder.query(QueryBuilders.matchAllQuery());
//sourceBuilder.aggregation(AggregationBuilders.terms("date_count").field("time").format("yyyy-MM-dd"));
sourceBuilder.aggregation(AggregationBuilders.dateHistogram("date_count").calendarInterval(DateHistogramInterval.DAY).field("time"));
SearchRequest searchRequest = new SearchRequest("order_*");
searchRequest.source(sourceBuilder);
SearchResponse searchResponse = client.search(searchRequest, RequestOptions.DEFAULT);
Aggregations aggregations = searchResponse.getAggregations();
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #spring #data #elasticsearch #aggregation #max
ADD COMMENT
Topic
Name
4+3 =