Просмотр исходного кода

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

jkzlzhoujie 6 лет назад
Родитель
Сommit
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);