-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Description
Part of #61768
As part of improving semantics in the esaggs expression function & making it available for more teams to use, we need to try to remove arguments that are blobs of stringified JSON.
Instead we will write functions for each of the agg types, as shown in the terms example here, which will only return data of type agg_type. Then as a follow-up step, we can update esaggs to only accept arguments of type agg_type for the agg configs. In this way we can enforce that anyone generating an agg config is doing so using each of these functions, which will make future maintainability much easier and prevent JSON blobs from being stored in expression strings everywhere.
Since there are so many agg types, we've broken the work into buckets and metrics. This issue exists to track work on expression functions for the bucket agg types:
-
date_histogram -
histogram - `range
-
date_range -
ip_range -
Done in [data.search.aggs]: Create agg types function for terms agg. #63541terms -
filter -
filters -
significant_terms -
geo_hash -
geo_tile
Steps for each agg type:
- Create an interface for the params of the agg type you are writing a function for
- note that all aggs will have
id,enabled,schema, andjson, in addition to the other params - params that are objects (such as
rangesin therangeagg) would ideally have expression functions created for them too so that they can be passed as subexpression arguments, but as a first step we can also simply stringify those objects in the expression function.
- note that all aggs will have
- Add the interface to
AggParamsMappingintypes.ts - Write the function, using the interface you wrote in step 1
- Write tests for the function
- Import your function in
agg_types.tsand add it togetAggTypesFunctions