如何使用java在elasticsearch中获得subAggregation?

时间:2015-07-01 08:25:55

标签: java elasticsearch

我有一个聚合,

MetricsAggregationBuilder aggregation =
            AggregationBuilders
                    .cardinality("agg")
                    .field("age");

我有另一个包含'agg'

的聚合
FilterAggregationBuilder filterAggregationBuilder = AggregationBuilders.filter("agf");
    filterAggregationBuilder.filter(FilterBuilders.termFilter("age", 20));
    filterAggregationBuilder.subAggregation(aggregation);

我可以使用

获得agf聚合
Cardinality agg2 = searchResponse.getAggregations().get("agf");

但我怎样才能得到聚合'agg'和'agg'的值

0 个答案:

没有答案