diff --git a/x-pack/plugins/task_manager/server/saved_objects/index.ts b/x-pack/plugins/task_manager/server/saved_objects/index.ts index 0ad9021cd7f39c..fbb54b566ece0d 100644 --- a/x-pack/plugins/task_manager/server/saved_objects/index.ts +++ b/x-pack/plugins/task_manager/server/saved_objects/index.ts @@ -6,6 +6,7 @@ import { SavedObjectsServiceSetup } from 'kibana/server'; import mappings from './mappings.json'; +import { migrations } from './migrations'; import { TaskManagerConfig } from '../config.js'; export function setupSavedObjects( @@ -18,6 +19,7 @@ export function setupSavedObjects( hidden: true, convertToAliasScript: `ctx._id = ctx._source.type + ':' + ctx._id`, mappings: mappings.task, + migrations, indexPattern: config.index, }); } diff --git a/x-pack/plugins/task_manager/server/saved_objects/migrations.ts b/x-pack/plugins/task_manager/server/saved_objects/migrations.ts index 1c2cf73d0fe134..98ae86b9e557f7 100644 --- a/x-pack/plugins/task_manager/server/saved_objects/migrations.ts +++ b/x-pack/plugins/task_manager/server/saved_objects/migrations.ts @@ -3,22 +3,19 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ -import { SavedObject } from '../../../../../src/core/server'; +import { SavedObjectMigrationMap } from '../../../../../src/core/server'; -export const migrations = { - task: { - '7.4.0': (doc: SavedObject>) => ({ - ...doc, - updated_at: new Date().toISOString(), - }), - '7.6.0': moveIntervalIntoSchedule, - }, +export const migrations: SavedObjectMigrationMap = { + '7.4.0': doc => ({ + ...doc, + updated_at: new Date().toISOString(), + }), + '7.6.0': moveIntervalIntoSchedule, }; -function moveIntervalIntoSchedule({ - attributes: { interval, ...attributes }, - ...doc -}: SavedObject>) { +// Type is wrong here and will be fixed by platform in https://github.com/elastic/kibana/issues/64748 +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function moveIntervalIntoSchedule({ attributes: { interval, ...attributes }, ...doc }: any): any { return { ...doc, attributes: {