瀏覽代碼

根据维度编码查询维度 类型

jkzlzhoujie 6 年之前
父節點
當前提交
fce73fd12e
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      src/main/java/com/yihu/quota/util/AggregationBuildHandler.java

+ 6 - 0
src/main/java/com/yihu/quota/util/AggregationBuildHandler.java

@ -19,7 +19,9 @@ import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.search.aggregations.AbstractAggregationBuilder;
import org.elasticsearch.search.aggregations.Aggregation;
import org.elasticsearch.search.aggregations.AggregationBuilders;
import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.bucket.filter.FilterAggregationBuilder;
import org.elasticsearch.search.aggregations.bucket.filter.InternalFilter;
import org.elasticsearch.search.aggregations.bucket.terms.*;
import org.elasticsearch.search.aggregations.metrics.avg.InternalAvg;
import org.elasticsearch.search.aggregations.metrics.max.InternalMax;
@ -410,6 +412,10 @@ public class AggregationBuildHandler {
        }else if (aggregation instanceof InternalAvg) {
            InternalAvg valueCount = (InternalAvg) aggregation;
            value = valueCount.getValue();
        }else if (aggregation instanceof InternalFilter) {
            InternalFilter internalFilter = (InternalFilter) aggregation;
            List<Aggregation> aggregationList = internalFilter.getAggregations().asList();
            value = getInternalAggValue(key,aggregationList.get(0));
        }
        if(value != null){
            map.put(key, value);