Skip to content

[7.x] [APM] Refactor & scope aggregation types (#48394)#49148

Merged
dgieselaar merged 1 commit intoelastic:7.xfrom
dgieselaar:backport/7.x/pr-48394
Oct 24, 2019
Merged

[7.x] [APM] Refactor & scope aggregation types (#48394)#49148
dgieselaar merged 1 commit intoelastic:7.xfrom
dgieselaar:backport/7.x/pr-48394

Conversation

@dgieselaar
Copy link
Copy Markdown
Contributor

Backports the following commits to 7.x:

* [APM] Refactor & scope aggregation types

Iterate on the APM aggregation types, make them more readable and explicitly scope them as APM-specific.

ES typings:
- Refactored aggregation types (mostly better naming, slightly less hacks)
- Do not add APM typings to `elasticsearch` module to explicitly scope them as APM specific
- Make restTotalHitsAsInt a type option rather than a separate type
- `terms` bucket key type now accounts for the fact it can be both number and string

`mergeProjection`:
- Type check arguments for compatibility with ESSearchRequest
- Require valid aggregation objects in source parameter. Seems less brittle, and surfaces errors closer to the source

Other changes:
- Sort options in some cases need `as const`, type casts or type guards
- Simplify types for metric aggregations

* Add type casts for bucket keys in remaining places

* Review feedback
@dgieselaar dgieselaar added the backport This PR is a backport of another PR label Oct 24, 2019
@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

@dgieselaar dgieselaar merged commit f658e94 into elastic:7.x Oct 24, 2019
@dgieselaar dgieselaar deleted the backport/7.x/pr-48394 branch October 24, 2019 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants