Using elastic search and java. Not using a json or other external resource for the query.
使用弹性搜索和java。不使用json或其他外部资源进行查询。
1 个解决方案
#1
1
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);
#1
1
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);