【发布时间】:2018-07-24 00:52:27
【问题描述】:
在 Elasticsearch 5.3 中有没有一种方法可以使用无痛脚本循环查询结果以计算查询返回的命中之间的差异。
我试图在脚本中的 for 循环中循环结果,但无法在哪个实体上循环,我希望脚本有类似更新 api 的 ctx.payload.hits.hits 可用于for 循环。
"script": {
"lang": "painless",
"inline": "int total = 0; for (int i = 0; i < ??? ; i++) { total += ???[i]._source['age'].value; } return total;"
}
【问题讨论】:
标签: elasticsearch elasticsearch-painless