Skip to content

Side Effects in Painless During Scripted Metric Aggregation #53679

@jdconrad

Description

@jdconrad

I want to discuss the behavior described here by @hendrikmuhs :

I have a design question: Painless lets me get the source via e.g. 
params['_source']. In the context of scripted metric you get a nasty side-
effect passing a value created from params['_source'] from one phase to the 
next. Because it works by reference, the content of a painless variable 
changes and you get wrong results. In order to work correctly you must 
create a copy by e.g. using new HashMap(params['_source']).

I wonder whether this is a bug. Full example: https://discuss.elastic.co/t/latest-full-document-in-transform/221435/4

Questions:

  1. Is this a bug?
  2. What behavior do we expect here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions