diff --git a/src/plugins/data/common/search/aggs/agg_types_registry.ts b/src/plugins/data/common/search/aggs/agg_types_registry.ts index e9eb6be9f11d..1af73d21b36b 100644 --- a/src/plugins/data/common/search/aggs/agg_types_registry.ts +++ b/src/plugins/data/common/search/aggs/agg_types_registry.ts @@ -91,8 +91,10 @@ export class AggTypesRegistry { start = ({ uiSettings }: AggTypesRegistryStartDependencies) => { const disabledBucketAgg = uiSettings.get('visualize:disableBucketAgg'); - for (const k of this.bucketAggs.keys()) { - if (disabledBucketAgg.includes(k)) this.bucketAggs.delete(k); + if (disabledBucketAgg !== undefined && Array.isArray(disabledBucketAgg)) { + for (const k of this.bucketAggs.keys()) { + if (disabledBucketAgg.includes(k)) this.bucketAggs.delete(k); + } } return { diff --git a/src/plugins/data/server/search/aggs/aggs_service.ts b/src/plugins/data/server/search/aggs/aggs_service.ts index 7d2cc502f370..8213038484ac 100644 --- a/src/plugins/data/server/search/aggs/aggs_service.ts +++ b/src/plugins/data/server/search/aggs/aggs_service.ts @@ -32,11 +32,7 @@ import { pick } from 'lodash'; -import { - UiSettingsServiceSetup, - UiSettingsServiceStart, - SavedObjectsClientContract, -} from 'src/core/server'; +import { UiSettingsServiceStart, SavedObjectsClientContract } from 'src/core/server'; import { ExpressionsServiceSetup } from 'src/plugins/expressions/common'; import { AggsCommonService, @@ -52,7 +48,6 @@ import { AggsSetup, AggsStart } from './types'; /** @internal */ export interface AggsSetupDependencies { registerFunction: ExpressionsServiceSetup['registerFunction']; - uiSettings: UiSettingsServiceSetup; } /** @internal */