mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[8.9][Fleet] Fix index patterns being recreated in default space, fix migr… (#164531)
Backport https://github.com/elastic/kibana/pull/164456 to 8.9 (only index pattern fix)
This commit is contained in:
parent
5e65000375
commit
b3a4723498
2 changed files with 20 additions and 3 deletions
|
@ -45,7 +45,12 @@ type SavedObjectToBe = Required<Pick<SavedObjectsBulkCreateObject, keyof Archive
|
|||
};
|
||||
export type ArchiveAsset = Pick<
|
||||
SavedObject,
|
||||
'id' | 'attributes' | 'migrationVersion' | 'references'
|
||||
| 'id'
|
||||
| 'attributes'
|
||||
| 'migrationVersion'
|
||||
| 'references'
|
||||
| 'coreMigrationVersion'
|
||||
| 'typeMigrationVersion'
|
||||
> & {
|
||||
type: KibanaSavedObjectType;
|
||||
};
|
||||
|
@ -81,13 +86,23 @@ export async function getKibanaAsset(key: string): Promise<ArchiveAsset> {
|
|||
|
||||
export function createSavedObjectKibanaAsset(asset: ArchiveAsset): SavedObjectToBe {
|
||||
// convert that to an object
|
||||
return {
|
||||
const so: Partial<SavedObjectToBe> = {
|
||||
type: asset.type,
|
||||
id: asset.id,
|
||||
attributes: asset.attributes,
|
||||
references: asset.references || [],
|
||||
migrationVersion: asset.migrationVersion || {},
|
||||
};
|
||||
|
||||
if (asset.migrationVersion) {
|
||||
so.migrationVersion = asset.migrationVersion;
|
||||
}
|
||||
if (asset.coreMigrationVersion) {
|
||||
so.coreMigrationVersion = asset.coreMigrationVersion;
|
||||
}
|
||||
if (asset.typeMigrationVersion) {
|
||||
so.typeMigrationVersion = asset.typeMigrationVersion;
|
||||
}
|
||||
return so as SavedObjectToBe;
|
||||
}
|
||||
|
||||
export async function installKibanaAssets(options: {
|
||||
|
|
|
@ -18,6 +18,8 @@ export function getIndexPatternSavedObjects() {
|
|||
return indexPatternTypes.map((indexPatternType) => ({
|
||||
id: `${indexPatternType}-*`,
|
||||
type: INDEX_PATTERN_SAVED_OBJECT_TYPE,
|
||||
// workaround until https://github.com/elastic/kibana/issues/164454 is fixed
|
||||
typeMigrationVersion: '8.0.0',
|
||||
attributes: {
|
||||
title: `${indexPatternType}-*`,
|
||||
timeFieldName: '@timestamp',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue