前言:
今天开发使用es进行聚合, 但是常规的聚合无法在聚合中进行复杂操作,
如:select avg(field1> 12), sum(round(field2, 1)) from table; 无奈下去官网查阅一番, 结果是:ES可以使用(
ScriptedMetricAggregationBuilder
)进行复杂的聚合操作但是目前处于试验阶段, 后期可能继续完善, 也可能删除.
官网原文:
This functionality is experimental and may be changed or removed completely in a future release. Elastic will take a best effort approach to fix any issues, but experimental features are not subject to the support SLA of official GA features.
案例:
POST ledger/_search?size=0 { "quer