From 2e45bf60642dfa0c0ecbc0281decb7ee3d134507 Mon Sep 17 00:00:00 2001 From: Lukas Olson Date: Tue, 4 Apr 2023 15:50:42 -0700 Subject: [PATCH] Update search session saved object mappings --- .../search/saved_objects/search_session.ts | 56 +++++++++---------- 1 file changed, 26 insertions(+), 30 deletions(-) diff --git a/src/plugins/data/server/search/saved_objects/search_session.ts b/src/plugins/data/server/search/saved_objects/search_session.ts index ef0f960c84e8c..598229075df42 100644 --- a/src/plugins/data/server/search/saved_objects/search_session.ts +++ b/src/plugins/data/server/search/saved_objects/search_session.ts @@ -6,6 +6,7 @@ * Side Public License, v 1. */ +import { schema } from '@kbn/config-schema'; import { SavedObjectsType } from '@kbn/core/server'; import { SEARCH_SESSION_TYPE } from '../../../common'; import { searchSessionSavedObjectMigrations } from './search_session_migration'; @@ -15,37 +16,14 @@ export const searchSessionSavedObjectType: SavedObjectsType = { namespaceType: 'single', hidden: true, mappings: { + dynamic: false, properties: { sessionId: { type: 'keyword', }, - name: { - type: 'keyword', - }, created: { type: 'date', }, - expires: { - type: 'date', - }, - appId: { - type: 'keyword', - }, - locatorId: { - type: 'keyword', - }, - initialState: { - dynamic: false, - properties: {}, - }, - restoreState: { - dynamic: false, - properties: {}, - }, - idMapping: { - dynamic: false, - properties: {}, - }, realmType: { type: 'keyword', }, @@ -55,14 +33,32 @@ export const searchSessionSavedObjectType: SavedObjectsType = { username: { type: 'keyword', }, - version: { - type: 'keyword', - }, - isCanceled: { - type: 'boolean', - }, }, }, + schemas: { + '8.8.0': schema.object({ + sessionId: schema.string(), + name: schema.maybe(schema.string()), + created: schema.string(), + expires: schema.string(), + appId: schema.maybe(schema.string()), + locatorId: schema.maybe(schema.string()), + initialState: schema.maybe(schema.object({}, { unknowns: 'allow' })), + restoreState: schema.maybe(schema.object({}, { unknowns: 'allow' })), + idMapping: schema.mapOf( + schema.string(), + schema.object({ + id: schema.string(), + strategy: schema.string(), + }) + ), + realmType: schema.maybe(schema.string()), + realmName: schema.maybe(schema.string()), + username: schema.maybe(schema.string()), + version: schema.string(), + isCanceled: schema.maybe(schema.boolean()), + }), + }, migrations: searchSessionSavedObjectMigrations, excludeOnUpgrade: async () => { return {