Skip to content

[data.search.aggs] Remove service getters from agg types #60333

@lukeelmers

Description

@lukeelmers

When aggs were migrated to the new platform data.search service, each of the runtime dependencies in the individual agg types were retrieved using service getters/setters (e.g. getUiSettings or getFieldFormats in src/plugins/data/public/services)

In practice there are very few use cases for these getters/setters, and it is good to get rid of them where we can since it makes testing & mocking more complicated.

We already have one example of how these agg types look without the getters/setters if you look at the filtersBucketAgg in buckets/filters: Basically it gets wrapped in a provider function which accepts the needed dependencies, returning the agg type instance.

  • search/aggs/buckets
  • search/aggs/metrics
  • search/aggs/param_types
  • search/aggs/test_helpers/mock_data_services
    • After updating the above items, see if this mocking helper is still necessary.
    • Most likely calls to mockDataServices() in the various unit tests can be removed and replaced with the simpler mocks provided by mocks.ts

Parent issue: #60126

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions