Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[data.search.aggs]: Expression functions for bucket agg types #63762

Closed
11 tasks done
lukeelmers opened this issue Apr 16, 2020 · 1 comment · Fixed by #64772
Closed
11 tasks done

[data.search.aggs]: Expression functions for bucket agg types #63762

lukeelmers opened this issue Apr 16, 2020 · 1 comment · Fixed by #64772
Assignees
Labels
Feature:Aggregations Aggregation infrastructure (AggConfig, esaggs, ...) Feature:ExpressionLanguage Interpreter expression language (aka canvas pipeline) v7.8.0

Comments

@lukeelmers
Copy link
Member

lukeelmers commented Apr 16, 2020

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:

Steps for each agg type:

  1. 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, and json, in addition to the other params
    • params that are objects (such as ranges in the range agg) 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.
  2. Add the interface to AggParamsMapping in types.ts
  3. Write the function, using the interface you wrote in step 1
  4. Write tests for the function
  5. Import your function in agg_types.ts and add it to getAggTypesFunctions
@lukeelmers lukeelmers added Feature:Aggregations Aggregation infrastructure (AggConfig, esaggs, ...) Feature:ExpressionLanguage Interpreter expression language (aka canvas pipeline) Team:AppArch v7.8.0 labels Apr 16, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-arch (Team:AppArch)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Aggregations Aggregation infrastructure (AggConfig, esaggs, ...) Feature:ExpressionLanguage Interpreter expression language (aka canvas pipeline) v7.8.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants