Using elastic search and java. Not using a json or other external resource for the query.
Asked
Active
Viewed 263 times
1 Answers
2
Something like this should do:
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);

Val
- 207,596
- 13
- 358
- 360
-
Which version of ES do you have? Pipeline aggregations are only available since ES 2.x – Val Jul 25 '16 at 13:51