Skip to content

字段运算后聚合结果为0 #791

@Jiuyong

Description

@Jiuyong

比如:
SELECT SUM(Rcvd + Sent) AS CNT FROM fire
生成的脚本为:
{ "from": 0, "size": 0, "_source": { "includes": [ "SUM" ], "excludes": [] }, "aggregations": { "CNT": { "sum": { "script": { "source": " def add_1765017519 = doc['Rcvd'].value + doc['Sent'].value", "lang": "painless" } } } } }
查询结果为 0 ,生成的脚本是否缺少 return add_1765017519;?
因为有结果的脚本:
SELECT (Rcvd + Sent) AS CNT FROM fire
生成的脚本为:
{ "from": 0, "size": 200, "_source": { "includes": [], "excludes": [] }, "script_fields": { "CNT": { "script": { "source": " def add_119484767 = doc['Rcvd'].value + doc['Sent'].value;return add_119484767;", "lang": "painless" }, "ignore_failure": false } } }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions