如何将直方图/date_histogram 定义为移动平均聚合的父项

How to define histogram / date_histogram as parent of a moving average aggregation

使用弹性搜索和 java。 未使用 json 或其他外部资源进行查询。

应该这样做:

SumAggregationBuilder sum = AggregationBuilders.sum("my_sum")
    .field("amount_field");

MovAvgPipelineAggregationBuilder mavg = PipelineAggregatorBuilders.movingAvg("my_mov_avg", "my_sum");

DateHistogramBuilder histo = AggregationBuilders.dateHistogram("histo")
     .field("date_field")
     .subAggregation(sum)
     .subAggregation(mavg);