AggConfig refactoring #44497
Labels
Feature:Aggregations
Aggregation infrastructure (AggConfig, esaggs, ...)
impact:low
Addressing this issue will have a low level of impact on the quality/strength of our product.
loe:x-large
Extra Large Level of Effort
Team:Visualizations
Visualization editors, elastic-charts and infrastructure
Peter and I discussed recently some changes and refactoring we want to do around
AggConfig
, which I'd like to outline in this issue.AggParam
and instead make it a property with getter/setter onAggConfig
itself (setDslParamsOverwrite(params: Record<string, unknown>)
). Then move the editor for it directly into the vis editor code, which will handle setting this property.AggConfig
should take care of using this property after generating the DSL from all parameters for overwrite. Remove the JSONAggParamType
after that.customLabel
, move it toAggConfig
with getter/setter and give it an editor.customLabels: boolean
option onAggType
, since we can set it on filters aggregations nowadays, and there should be no need for this anymore.AggType
have one top-leveltoDsl
method instead of every parameter having it's ownwrite
method. Currently every parameter writes itself out, or doesn't or very often just willy-nilly also handles other parameters. With one top-level method we will have a way cleaner approach to that.AggParamType
is still allowed to have awrite
method.toDsl(aggConfig: AggConfig, params: Record<string, unknown>)
on theAggConfig
when needing to generate the DSL. The params we'll pass in, will be already converted by thewrite
method of theAggParamType
if there was one (so e.g. thefield
parameter will already be the correct DSL, potentially a script depending on the field, and not just the plain field name).{ aggName: string; params: Record<string, unkown>; parentAggs }
, whileparentAggs
being the parent aggs as they exist already today.write: _.noop
. It also allows us to create different type of aggregations (e.g.date_histogram
vsauto_date_histogram
) depending on the specificAggConfig
or parameters to it.subAggs
in thetoDsl
calls, by actually requiring the aggregation who wants sub aggregations to directly calltoDsl
on theAggConfig
s of it sub aggregations and assign them to itsaggs
parameter in the DSL.cc @ppisljar
Parent issue #60126
The text was updated successfully, but these errors were encountered: