Java Code Examples for org.elasticsearch.search.aggregations.bucket.range.Range#Bucket

The following examples show how to use org.elasticsearch.search.aggregations.bucket.range.Range#Bucket . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AggregationServiceImpl.java    From microservices-platform with Apache License 2.0 5 votes vote down vote up
/**
 * 赋值当天统计
 */
private void setCurrDate(Map<String, Object> result, Aggregations aggregations) {
    ParsedDateRange currDate = aggregations.get("currDate");
    Range.Bucket bucket = currDate.getBuckets().get(0);
    Cardinality cardinality = bucket.getAggregations().get("uv");
    result.put("currDate_pv", bucket.getDocCount());
    result.put("currDate_uv", cardinality.getValue());
}
 
Example 2
Source File: AggregationServiceImpl.java    From microservices-platform with Apache License 2.0 5 votes vote down vote up
/**
 * 赋值周统计
 */
private void setCurr24Hour(Map<String, Object> result, Aggregations aggregations) {
    ParsedDateRange curr24Hour = aggregations.get("curr24Hour");
    Range.Bucket bucket = curr24Hour.getBuckets().get(0);
    //赋值天趋势统计
    setStatDate(result, bucket.getAggregations());
}
 
Example 3
Source File: AggregationServiceImpl.java    From microservices-platform with Apache License 2.0 5 votes vote down vote up
/**
 * 赋值周统计
 */
private void setCurrWeek(Map<String, Object> result, Aggregations aggregations) {
    ParsedDateRange currWeek = aggregations.get("currWeek");
    Range.Bucket bucket = currWeek.getBuckets().get(0);
    result.put("currWeek_pv", bucket.getDocCount());
    //赋值周趋势统计
    setStatWeek(result, bucket.getAggregations());
}
 
Example 4
Source File: AggregationServiceImpl.java    From microservices-platform with Apache License 2.0 5 votes vote down vote up
/**
 * 赋值小时内统计-当前在线数
 */
private void setCurrHour(Map<String, Object> result, Aggregations aggregations) {
    ParsedDateRange currDate = aggregations.get("currHour");
    Range.Bucket bucket = currDate.getBuckets().get(0);
    Cardinality cardinality = bucket.getAggregations().get("uv");
    result.put("currHour_uv", cardinality.getValue());
}
 
Example 5
Source File: JdbcResponseExtractor.java    From elasticsearch-sql with MIT License 5 votes vote down vote up
private void parseRangeAggregation(Aggregation aggregation, Map<String, Object> aggMap) {
    Range range = (Range) aggregation;
    List<Map<String, Object>> rangeList = new ArrayList<>(0);
    for (Range.Bucket bucket : range.getBuckets()) {
        Map<String, Object> rangeItem = new HashMap<>(0);
        rangeItem.put(bucket.getKeyAsString(), bucket.getDocCount());
        rangeList.add(rangeItem);
    }
    aggMap.put(range.getName(), rangeList);
}
 
Example 6
Source File: AggregationServiceImpl.java    From microservices-platform with Apache License 2.0 4 votes vote down vote up
/**
 * 赋值月统计
 */
private void setCurrMonth(Map<String, Object> result, Aggregations aggregations) {
    ParsedDateRange currMonth = aggregations.get("currMonth");
    Range.Bucket bucket = currMonth.getBuckets().get(0);
    result.put("currMonth_pv", bucket.getDocCount());
}