Skip to content

Make the combine_script and reduce_script required in the scripted_metric aggregation #32804

@colings86

Description

@colings86

Currently int he scripted_metric aggregation only the map_script script is required. This can lead to users getting into problems such as [1] where they forget to, or don't realise they need to, provide a combine_script and/or reduce_script causing weird looking results in the response. I can't think of a reason why you would not want a combine_Script and/or reduce_script so I think we should make both of these mandatory. If someone does have a use-case where they don't need one of these scripts, it should be trivial to write a script that passes the input state straight to the return value.

I think the init_script should remain optional however, since I can see use cases where no set up is required before collecting documents.

In terms of bwc I think we will just need to add a deprecation warning if the scripted_metric agg is supplied without a combine_script and/or reduce_script warning the user that these scripts will be required in the next major version.

[1] https://discuss.elastic.co/t/scripted-metric-aggregations-sorting/143719/4

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions