import { get , omit , flow , some } from 'lodash' ; import type { SavedObjectMigrationFn } from 'kibana/server' ; const v716RemoveUnusedTelemetry = ( doc ) => { const attributesBlocklist = [ 'ui_open.cluster' , 'ui_open.indices' , 'ui_open.overview' , 'ui_reindex.close' , 'ui_reindex.open' , 'ui_reindex.start' , 'ui_reindex.stop' , ] ; const isDocEligible = some ( attributesBlocklist , ( attribute ) => { return get ( doc , 'attributes' , attribute ) ; } ) ; if ( isDocEligible ) { return { ... doc , attributes : omit ( doc . attributes , attributesBlocklist ) , } ; } return doc ; } ; export const telemetrySavedObjectMigrations = { '7.16.0' : flow ( v716RemoveUnusedTelemetry ) , } ;