You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running a scripted_metric aggregation (in 2.3.x and 5.0.0-alpha4), if the user needs to specify some parameters in the params section, the implicit _agg hashmap disappears.
One gets an error stating No such property: _agg for class: b0b7ce0d2dbb5254a703a6f4d048654c3f84857b. There are obviously no errors without the params section.
In order for this to work, one needs to re-specify the _agg implicit parameter in the params section like this:
I'm not sure if this is done on purpose, but it feels a bit counterintuitive. The official documentation (see below) states that _agg is an implicit hashmap, but doesn't state that _agg needs to be explicitly re-defined if other parameters are defined in params .
If this is not specified, the default is the equivalent of providing:
)
* Fixes#19768: scripted_metric _agg parameter disappears if params are provided
* Test case for #19768
* Compare boolean to false instead of negating it
* Added mocked script in ScriptedMetricIT
* Fix test in ScriptedMetricIT for implicit _agg map
)
* Fixes#19768: scripted_metric _agg parameter disappears if params are provided
* Test case for #19768
* Compare boolean to false instead of negating it
* Added mocked script in ScriptedMetricIT
* Fix test in ScriptedMetricIT for implicit _agg map
When running a
scripted_metric
aggregation (in 2.3.x and 5.0.0-alpha4), if the user needs to specify some parameters in theparams
section, the implicit_agg
hashmap disappears.When running the following dummy query:
One gets an error stating
No such property: _agg for class: b0b7ce0d2dbb5254a703a6f4d048654c3f84857b
. There are obviously no errors without theparams
section.In order for this to work, one needs to re-specify the
_agg
implicit parameter in theparams
section like this:I'm not sure if this is done on purpose, but it feels a bit counterintuitive. The official documentation (see below) states that
_agg
is an implicit hashmap, but doesn't state that_agg
needs to be explicitly re-defined if other parameters are defined inparams
.I think this could be easily fixed by modifying
ScriptedMetricAggregatorFactory.createInternal()
like this:Note: If this is deemed worthy, I can gladly submit a PR.
The text was updated successfully, but these errors were encountered: