From 3e8f3400d59107f4f9759e1e92e7177913b72afc Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Thu, 23 Apr 2020 09:46:52 -0700 Subject: [PATCH 1/8] Remove stub legacy index_management plugin. --- x-pack/index.js | 2 -- x-pack/legacy/plugins/index_management/index.ts | 13 ------------- 2 files changed, 15 deletions(-) delete mode 100644 x-pack/legacy/plugins/index_management/index.ts diff --git a/x-pack/index.js b/x-pack/index.js index 43ae5c3e5c5dd..0b685b737ddb5 100644 --- a/x-pack/index.js +++ b/x-pack/index.js @@ -13,7 +13,6 @@ import { dashboardMode } from './legacy/plugins/dashboard_mode'; import { beats } from './legacy/plugins/beats_management'; import { apm } from './legacy/plugins/apm'; import { maps } from './legacy/plugins/maps'; -import { indexManagement } from './legacy/plugins/index_management'; import { spaces } from './legacy/plugins/spaces'; import { canvas } from './legacy/plugins/canvas'; import { infra } from './legacy/plugins/infra'; @@ -42,7 +41,6 @@ module.exports = function(kibana) { apm(kibana), maps(kibana), canvas(kibana), - indexManagement(kibana), infra(kibana), taskManager(kibana), rollup(kibana), diff --git a/x-pack/legacy/plugins/index_management/index.ts b/x-pack/legacy/plugins/index_management/index.ts deleted file mode 100644 index afca15203b970..0000000000000 --- a/x-pack/legacy/plugins/index_management/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -// TODO: Remove this once CCR is migrated to the plugins directory. -export function indexManagement(kibana: any) { - return new kibana.Plugin({ - id: 'index_management', - configPrefix: 'xpack.index_management', - }); -} From 91b332b0ecc8cc65ea3047563d80c717ac55b37f Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Thu, 23 Apr 2020 10:01:16 -0700 Subject: [PATCH 2/8] Remove stub legacy remote_clusters plugin and move styles to NP plugin. --- x-pack/index.js | 2 - .../plugins/remote_clusters/common/index.ts | 9 ----- .../legacy/plugins/remote_clusters/index.ts | 40 ------------------- .../public/application/index.js | 2 + .../public/application}/index.scss | 3 -- 5 files changed, 2 insertions(+), 54 deletions(-) delete mode 100644 x-pack/legacy/plugins/remote_clusters/common/index.ts delete mode 100644 x-pack/legacy/plugins/remote_clusters/index.ts rename x-pack/{legacy/plugins/remote_clusters/public => plugins/remote_clusters/public/application}/index.scss (86%) diff --git a/x-pack/index.js b/x-pack/index.js index 0b685b737ddb5..b10be3e4d5b93 100644 --- a/x-pack/index.js +++ b/x-pack/index.js @@ -19,7 +19,6 @@ import { infra } from './legacy/plugins/infra'; import { taskManager } from './legacy/plugins/task_manager'; import { rollup } from './legacy/plugins/rollup'; import { siem } from './legacy/plugins/siem'; -import { remoteClusters } from './legacy/plugins/remote_clusters'; import { upgradeAssistant } from './legacy/plugins/upgrade_assistant'; import { uptime } from './legacy/plugins/uptime'; import { encryptedSavedObjects } from './legacy/plugins/encrypted_saved_objects'; @@ -45,7 +44,6 @@ module.exports = function(kibana) { taskManager(kibana), rollup(kibana), siem(kibana), - remoteClusters(kibana), upgradeAssistant(kibana), uptime(kibana), encryptedSavedObjects(kibana), diff --git a/x-pack/legacy/plugins/remote_clusters/common/index.ts b/x-pack/legacy/plugins/remote_clusters/common/index.ts deleted file mode 100644 index baad348d7a136..0000000000000 --- a/x-pack/legacy/plugins/remote_clusters/common/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -export const PLUGIN = { - ID: 'remoteClusters', -}; diff --git a/x-pack/legacy/plugins/remote_clusters/index.ts b/x-pack/legacy/plugins/remote_clusters/index.ts deleted file mode 100644 index 439cb818d8a56..0000000000000 --- a/x-pack/legacy/plugins/remote_clusters/index.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { resolve } from 'path'; -import { Legacy } from 'kibana'; - -import { PLUGIN } from './common'; - -export function remoteClusters(kibana: any) { - return new kibana.Plugin({ - id: PLUGIN.ID, - configPrefix: 'xpack.remote_clusters', - publicDir: resolve(__dirname, 'public'), - require: ['kibana'], - uiExports: { - styleSheetPaths: resolve(__dirname, 'public/index.scss'), - }, - // TODO: Remove once CCR has migrated to NP - config(Joi: any) { - return Joi.object({ - // display menu item - ui: Joi.object({ - enabled: Joi.boolean().default(true), - }).default(), - - // enable plugin - enabled: Joi.boolean().default(true), - }).default(); - }, - isEnabled(config: Legacy.KibanaConfig) { - return ( - config.get('xpack.remote_clusters.enabled') && config.get('xpack.index_management.enabled') - ); - }, - init() {}, - }); -} diff --git a/x-pack/plugins/remote_clusters/public/application/index.js b/x-pack/plugins/remote_clusters/public/application/index.js index f2d788c741342..c0c831c1aee8f 100644 --- a/x-pack/plugins/remote_clusters/public/application/index.js +++ b/x-pack/plugins/remote_clusters/public/application/index.js @@ -13,6 +13,8 @@ import { App } from './app'; import { remoteClustersStore } from './store'; import { AppContextProvider } from './app_context'; +import './index.scss'; + export const renderApp = (elem, I18nContext, appDependencies) => { render( diff --git a/x-pack/legacy/plugins/remote_clusters/public/index.scss b/x-pack/plugins/remote_clusters/public/application/index.scss similarity index 86% rename from x-pack/legacy/plugins/remote_clusters/public/index.scss rename to x-pack/plugins/remote_clusters/public/application/index.scss index 4ae11323642d8..ab976d98219a2 100644 --- a/x-pack/legacy/plugins/remote_clusters/public/index.scss +++ b/x-pack/plugins/remote_clusters/public/application/index.scss @@ -1,6 +1,3 @@ -// Import the EUI global scope so we can use EUI constants -@import 'src/legacy/ui/public/styles/_styling_constants'; - // Remote clusters plugin styles // Prefix all styles with "remoteClusters" to avoid conflicts. From 28b81725936e020d28828215b1996974efb8b113 Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Thu, 23 Apr 2020 11:38:06 -0700 Subject: [PATCH 3/8] Remove stub legacy upgrade_assistant plugin and move saved object types to NP plugin. - Update SavedObjectsCoreFieldMapping with null_field parameter. --- .../server/saved_objects/mappings/types.ts | 1 + x-pack/index.js | 2 - .../legacy/plugins/upgrade_assistant/index.ts | 28 -------- .../plugins/upgrade_assistant/mappings.json | 65 ------------------- .../upgrade_assistant/server/plugin.ts | 15 ++++- .../server/saved_object_types/index.ts | 8 +++ .../reindex_operation_saved_object_type.ts | 23 +++++++ .../telemetry_saved_object_type.ts | 65 +++++++++++++++++++ 8 files changed, 109 insertions(+), 98 deletions(-) delete mode 100644 x-pack/legacy/plugins/upgrade_assistant/index.ts delete mode 100644 x-pack/legacy/plugins/upgrade_assistant/mappings.json create mode 100644 x-pack/plugins/upgrade_assistant/server/saved_object_types/index.ts create mode 100644 x-pack/plugins/upgrade_assistant/server/saved_object_types/reindex_operation_saved_object_type.ts create mode 100644 x-pack/plugins/upgrade_assistant/server/saved_object_types/telemetry_saved_object_type.ts diff --git a/src/core/server/saved_objects/mappings/types.ts b/src/core/server/saved_objects/mappings/types.ts index 47fc29f8cf7d2..c1b65763949bb 100644 --- a/src/core/server/saved_objects/mappings/types.ts +++ b/src/core/server/saved_objects/mappings/types.ts @@ -131,6 +131,7 @@ export interface IndexMappingMeta { */ export interface SavedObjectsCoreFieldMapping { type: string; + null_value?: number | boolean | string; index?: boolean; enabled?: boolean; fields?: { diff --git a/x-pack/index.js b/x-pack/index.js index b10be3e4d5b93..d1dd9a37983da 100644 --- a/x-pack/index.js +++ b/x-pack/index.js @@ -19,7 +19,6 @@ import { infra } from './legacy/plugins/infra'; import { taskManager } from './legacy/plugins/task_manager'; import { rollup } from './legacy/plugins/rollup'; import { siem } from './legacy/plugins/siem'; -import { upgradeAssistant } from './legacy/plugins/upgrade_assistant'; import { uptime } from './legacy/plugins/uptime'; import { encryptedSavedObjects } from './legacy/plugins/encrypted_saved_objects'; import { actions } from './legacy/plugins/actions'; @@ -44,7 +43,6 @@ module.exports = function(kibana) { taskManager(kibana), rollup(kibana), siem(kibana), - upgradeAssistant(kibana), uptime(kibana), encryptedSavedObjects(kibana), actions(kibana), diff --git a/x-pack/legacy/plugins/upgrade_assistant/index.ts b/x-pack/legacy/plugins/upgrade_assistant/index.ts deleted file mode 100644 index b5e8ce4750215..0000000000000 --- a/x-pack/legacy/plugins/upgrade_assistant/index.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ -import { Legacy } from 'kibana'; -import mappings from './mappings.json'; - -export function upgradeAssistant(kibana: any) { - const config: Legacy.PluginSpecOptions = { - id: 'upgrade_assistant', - uiExports: { - // @ts-ignore - savedObjectSchemas: { - 'upgrade-assistant-reindex-operation': { - isNamespaceAgnostic: true, - }, - 'upgrade-assistant-telemetry': { - isNamespaceAgnostic: true, - }, - }, - mappings, - }, - - init() {}, - }; - return new kibana.Plugin(config); -} diff --git a/x-pack/legacy/plugins/upgrade_assistant/mappings.json b/x-pack/legacy/plugins/upgrade_assistant/mappings.json deleted file mode 100644 index 885ac4d5a9b44..0000000000000 --- a/x-pack/legacy/plugins/upgrade_assistant/mappings.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "upgrade-assistant-reindex-operation": { - "dynamic": true, - "properties": { - "indexName": { - "type": "keyword" - }, - "status": { - "type": "integer" - } - } - }, - "upgrade-assistant-telemetry": { - "properties": { - "ui_open": { - "properties": { - "overview": { - "type": "long", - "null_value": 0 - }, - "cluster": { - "type": "long", - "null_value": 0 - }, - "indices": { - "type": "long", - "null_value": 0 - } - } - }, - "ui_reindex": { - "properties": { - "close": { - "type": "long", - "null_value": 0 - }, - "open": { - "type": "long", - "null_value": 0 - }, - "start": { - "type": "long", - "null_value": 0 - }, - "stop": { - "type": "long", - "null_value": 0 - } - } - }, - "features": { - "properties": { - "deprecation_logging": { - "properties": { - "enabled": { - "type": "boolean", - "null_value": true - } - } - } - } - } - } - } -} diff --git a/x-pack/plugins/upgrade_assistant/server/plugin.ts b/x-pack/plugins/upgrade_assistant/server/plugin.ts index bdca506cc7338..0cdf1ca05feac 100644 --- a/x-pack/plugins/upgrade_assistant/server/plugin.ts +++ b/x-pack/plugins/upgrade_assistant/server/plugin.ts @@ -25,6 +25,8 @@ import { registerClusterCheckupRoutes } from './routes/cluster_checkup'; import { registerDeprecationLoggingRoutes } from './routes/deprecation_logging'; import { registerReindexIndicesRoutes, createReindexWorker } from './routes/reindex_indices'; import { registerTelemetryRoutes } from './routes/telemetry'; +import { telemetrySavedObjectType, reindexOperationSavedObjectType } from './saved_object_types'; + import { RouteDependencies } from './types'; interface PluginsSetup { @@ -57,11 +59,14 @@ export class UpgradeAssistantServerPlugin implements Plugin { } setup( - { http, getStartServices, capabilities }: CoreSetup, + { http, getStartServices, capabilities, savedObjects }: CoreSetup, { usageCollection, cloud, licensing }: PluginsSetup ) { this.licensing = licensing; + savedObjects.registerType(reindexOperationSavedObjectType); + savedObjects.registerType(telemetrySavedObjectType); + const router = http.createRouter(); const dependencies: RouteDependencies = { @@ -85,8 +90,12 @@ export class UpgradeAssistantServerPlugin implements Plugin { registerTelemetryRoutes(dependencies); if (usageCollection) { - getStartServices().then(([{ savedObjects, elasticsearch }]) => { - registerUpgradeAssistantUsageCollector({ elasticsearch, usageCollection, savedObjects }); + getStartServices().then(([{ savedObjects: savedObjectsService, elasticsearch }]) => { + registerUpgradeAssistantUsageCollector({ + elasticsearch, + usageCollection, + savedObjects: savedObjectsService, + }); }); } } diff --git a/x-pack/plugins/upgrade_assistant/server/saved_object_types/index.ts b/x-pack/plugins/upgrade_assistant/server/saved_object_types/index.ts new file mode 100644 index 0000000000000..dee0a74d8994b --- /dev/null +++ b/x-pack/plugins/upgrade_assistant/server/saved_object_types/index.ts @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export { reindexOperationSavedObjectType } from './reindex_operation_saved_object_type'; +export { telemetrySavedObjectType } from './telemetry_saved_object_type'; diff --git a/x-pack/plugins/upgrade_assistant/server/saved_object_types/reindex_operation_saved_object_type.ts b/x-pack/plugins/upgrade_assistant/server/saved_object_types/reindex_operation_saved_object_type.ts new file mode 100644 index 0000000000000..e34895fcdee26 --- /dev/null +++ b/x-pack/plugins/upgrade_assistant/server/saved_object_types/reindex_operation_saved_object_type.ts @@ -0,0 +1,23 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { SavedObjectsType } from 'src/core/server'; + +export const reindexOperationSavedObjectType: SavedObjectsType = { + name: 'upgrade-assistant-reindex-operation', + hidden: false, + namespaceType: 'agnostic', + mappings: { + properties: { + indexName: { + type: 'keyword', + }, + status: { + type: 'integer', + }, + }, + }, +}; diff --git a/x-pack/plugins/upgrade_assistant/server/saved_object_types/telemetry_saved_object_type.ts b/x-pack/plugins/upgrade_assistant/server/saved_object_types/telemetry_saved_object_type.ts new file mode 100644 index 0000000000000..2ec3be5576912 --- /dev/null +++ b/x-pack/plugins/upgrade_assistant/server/saved_object_types/telemetry_saved_object_type.ts @@ -0,0 +1,65 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { SavedObjectsType } from 'src/core/server'; + +export const telemetrySavedObjectType: SavedObjectsType = { + name: 'upgrade-assistant-telemetry', + hidden: false, + namespaceType: 'agnostic', + mappings: { + properties: { + ui_open: { + properties: { + overview: { + type: 'long', + null_value: 0, + }, + cluster: { + type: 'long', + null_value: 0, + }, + indices: { + type: 'long', + null_value: 0, + }, + }, + }, + ui_reindex: { + properties: { + close: { + type: 'long', + null_value: 0, + }, + open: { + type: 'long', + null_value: 0, + }, + start: { + type: 'long', + null_value: 0, + }, + stop: { + type: 'long', + null_value: 0, + }, + }, + }, + features: { + properties: { + deprecation_logging: { + properties: { + enabled: { + type: 'boolean', + null_value: true, + }, + }, + }, + }, + }, + }, + }, +}; From 54928494754d008f1f289660bb20ed7d56c72a77 Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Thu, 23 Apr 2020 11:41:51 -0700 Subject: [PATCH 4/8] Rename hacks.scss. --- .../public/application/{index.scss => _hacks.scss} | 2 +- x-pack/plugins/remote_clusters/public/application/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename x-pack/plugins/remote_clusters/public/application/{index.scss => _hacks.scss} (95%) diff --git a/x-pack/plugins/remote_clusters/public/application/index.scss b/x-pack/plugins/remote_clusters/public/application/_hacks.scss similarity index 95% rename from x-pack/plugins/remote_clusters/public/application/index.scss rename to x-pack/plugins/remote_clusters/public/application/_hacks.scss index ab976d98219a2..b7d81885e716d 100644 --- a/x-pack/plugins/remote_clusters/public/application/index.scss +++ b/x-pack/plugins/remote_clusters/public/application/_hacks.scss @@ -1,4 +1,4 @@ -// Remote clusters plugin styles +// Remote clusters plugin hacks // Prefix all styles with "remoteClusters" to avoid conflicts. // Examples diff --git a/x-pack/plugins/remote_clusters/public/application/index.js b/x-pack/plugins/remote_clusters/public/application/index.js index c0c831c1aee8f..cf6e855ba58df 100644 --- a/x-pack/plugins/remote_clusters/public/application/index.js +++ b/x-pack/plugins/remote_clusters/public/application/index.js @@ -13,7 +13,7 @@ import { App } from './app'; import { remoteClustersStore } from './store'; import { AppContextProvider } from './app_context'; -import './index.scss'; +import './_hacks.scss'; export const renderApp = (elem, I18nContext, appDependencies) => { render( From 1cd73b36746b50ba663d1bc7a615f0db5d985a47 Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Thu, 23 Apr 2020 16:09:11 -0700 Subject: [PATCH 5/8] Update core API docs. --- .../core/server/kibana-plugin-core-server.md | 1 + ...ugin-core-server.savedobjectscorefieldmapping.md | 1 + ...erver.savedobjectscorefieldmapping.null_value.md | 11 +++++++++++ ...-plugin-core-server.savedobjectunsanitizeddoc.md | 13 +++++++++++++ src/core/server/server.api.md | 2 ++ 5 files changed, 28 insertions(+) create mode 100644 docs/development/core/server/kibana-plugin-core-server.savedobjectscorefieldmapping.null_value.md create mode 100644 docs/development/core/server/kibana-plugin-core-server.savedobjectunsanitizeddoc.md diff --git a/docs/development/core/server/kibana-plugin-core-server.md b/docs/development/core/server/kibana-plugin-core-server.md index 5450e84417f89..8ceb4f2090df8 100644 --- a/docs/development/core/server/kibana-plugin-core-server.md +++ b/docs/development/core/server/kibana-plugin-core-server.md @@ -270,6 +270,7 @@ The plugin integrates with the core system via lifecycle events: `setup` | [SavedObjectsClientWrapperFactory](./kibana-plugin-core-server.savedobjectsclientwrapperfactory.md) | Describes the factory used to create instances of Saved Objects Client Wrappers. | | [SavedObjectsFieldMapping](./kibana-plugin-core-server.savedobjectsfieldmapping.md) | Describe a [saved object type mapping](./kibana-plugin-core-server.savedobjectstypemappingdefinition.md) field.Please refer to [elasticsearch documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-types.html) For the mapping documentation | | [SavedObjectsNamespaceType](./kibana-plugin-core-server.savedobjectsnamespacetype.md) | The namespace type dictates how a saved object can be interacted in relation to namespaces. Each type is mutually exclusive: \* single (default): this type of saved object is namespace-isolated, e.g., it exists in only one namespace. \* multiple: this type of saved object is shareable, e.g., it can exist in one or more namespaces. \* agnostic: this type of saved object is global.Note: do not write logic that uses this value directly; instead, use the appropriate accessors in the [type registry](./kibana-plugin-core-server.savedobjecttyperegistry.md). | +| [SavedObjectUnsanitizedDoc](./kibana-plugin-core-server.savedobjectunsanitizeddoc.md) | We want to have two types, one that guarantees a "references" attribute will exist and one that allows it to be null. Since we're not migrating all the saved objects to have a "references" array, we need to support the scenarios where it may be missing (ex migrations). | | [ScopeableRequest](./kibana-plugin-core-server.scopeablerequest.md) | A user credentials container. It accommodates the necessary auth credentials to impersonate the current user.See [KibanaRequest](./kibana-plugin-core-server.kibanarequest.md). | | [ServiceStatusLevel](./kibana-plugin-core-server.servicestatuslevel.md) | A convenience type that represents the union of each value in [ServiceStatusLevels](./kibana-plugin-core-server.servicestatuslevels.md). | | [SharedGlobalConfig](./kibana-plugin-core-server.sharedglobalconfig.md) | | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectscorefieldmapping.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectscorefieldmapping.md index 96f1143630856..dbc7d0ca431ce 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectscorefieldmapping.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectscorefieldmapping.md @@ -19,5 +19,6 @@ export interface SavedObjectsCoreFieldMapping | [enabled](./kibana-plugin-core-server.savedobjectscorefieldmapping.enabled.md) | boolean | | | [fields](./kibana-plugin-core-server.savedobjectscorefieldmapping.fields.md) | {
[subfield: string]: {
type: string;
};
} | | | [index](./kibana-plugin-core-server.savedobjectscorefieldmapping.index.md) | boolean | | +| [null\_value](./kibana-plugin-core-server.savedobjectscorefieldmapping.null_value.md) | number | boolean | string | | | [type](./kibana-plugin-core-server.savedobjectscorefieldmapping.type.md) | string | | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectscorefieldmapping.null_value.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectscorefieldmapping.null_value.md new file mode 100644 index 0000000000000..627ea3695383a --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectscorefieldmapping.null_value.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [SavedObjectsCoreFieldMapping](./kibana-plugin-core-server.savedobjectscorefieldmapping.md) > [null\_value](./kibana-plugin-core-server.savedobjectscorefieldmapping.null_value.md) + +## SavedObjectsCoreFieldMapping.null\_value property + +Signature: + +```typescript +null_value?: number | boolean | string; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectunsanitizeddoc.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectunsanitizeddoc.md new file mode 100644 index 0000000000000..fe4eaecd003d0 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectunsanitizeddoc.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [SavedObjectUnsanitizedDoc](./kibana-plugin-core-server.savedobjectunsanitizeddoc.md) + +## SavedObjectUnsanitizedDoc type + +We want to have two types, one that guarantees a "references" attribute will exist and one that allows it to be null. Since we're not migrating all the saved objects to have a "references" array, we need to support the scenarios where it may be missing (ex migrations). + +Signature: + +```typescript +export declare type SavedObjectUnsanitizedDoc = SavedObjectDoc & Partial; +``` diff --git a/src/core/server/server.api.md b/src/core/server/server.api.md index 6369720ada2c3..45e9b56698943 100644 --- a/src/core/server/server.api.md +++ b/src/core/server/server.api.md @@ -1840,6 +1840,8 @@ export interface SavedObjectsCoreFieldMapping { // (undocumented) index?: boolean; // (undocumented) + null_value?: number | boolean | string; + // (undocumented) type: string; } From fb74c853be820d27261d1f052601167ec0659d3c Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Fri, 24 Apr 2020 09:26:56 -0700 Subject: [PATCH 6/8] Use UA constants to define saved object type names. --- .../saved_object_types/reindex_operation_saved_object_type.ts | 4 +++- .../server/saved_object_types/telemetry_saved_object_type.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/upgrade_assistant/server/saved_object_types/reindex_operation_saved_object_type.ts b/x-pack/plugins/upgrade_assistant/server/saved_object_types/reindex_operation_saved_object_type.ts index e34895fcdee26..98a604715c08a 100644 --- a/x-pack/plugins/upgrade_assistant/server/saved_object_types/reindex_operation_saved_object_type.ts +++ b/x-pack/plugins/upgrade_assistant/server/saved_object_types/reindex_operation_saved_object_type.ts @@ -6,8 +6,10 @@ import { SavedObjectsType } from 'src/core/server'; +import { REINDEX_OP_TYPE } from '../../common/types'; + export const reindexOperationSavedObjectType: SavedObjectsType = { - name: 'upgrade-assistant-reindex-operation', + name: REINDEX_OP_TYPE, hidden: false, namespaceType: 'agnostic', mappings: { diff --git a/x-pack/plugins/upgrade_assistant/server/saved_object_types/telemetry_saved_object_type.ts b/x-pack/plugins/upgrade_assistant/server/saved_object_types/telemetry_saved_object_type.ts index 2ec3be5576912..b1321e634c0f1 100644 --- a/x-pack/plugins/upgrade_assistant/server/saved_object_types/telemetry_saved_object_type.ts +++ b/x-pack/plugins/upgrade_assistant/server/saved_object_types/telemetry_saved_object_type.ts @@ -6,8 +6,10 @@ import { SavedObjectsType } from 'src/core/server'; +import { UPGRADE_ASSISTANT_TYPE } from '../../common/types'; + export const telemetrySavedObjectType: SavedObjectsType = { - name: 'upgrade-assistant-telemetry', + name: UPGRADE_ASSISTANT_TYPE, hidden: false, namespaceType: 'agnostic', mappings: { From 6d70a6ab55354e9f13d8016da605520707f83451 Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Fri, 24 Apr 2020 11:03:07 -0700 Subject: [PATCH 7/8] Fix UA test failures by adding missing mappings. --- .../reindex_operation_saved_object_type.ts | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/x-pack/plugins/upgrade_assistant/server/saved_object_types/reindex_operation_saved_object_type.ts b/x-pack/plugins/upgrade_assistant/server/saved_object_types/reindex_operation_saved_object_type.ts index 98a604715c08a..ba661fbeceb26 100644 --- a/x-pack/plugins/upgrade_assistant/server/saved_object_types/reindex_operation_saved_object_type.ts +++ b/x-pack/plugins/upgrade_assistant/server/saved_object_types/reindex_operation_saved_object_type.ts @@ -14,12 +14,50 @@ export const reindexOperationSavedObjectType: SavedObjectsType = { namespaceType: 'agnostic', mappings: { properties: { + reindexTaskId: { + type: 'keyword', + }, indexName: { type: 'keyword', }, + newIndexName: { + type: 'keyword', + }, status: { type: 'integer', }, + locked: { + type: 'date', + }, + lastCompletedStep: { + type: 'integer', + }, + errorMessage: { + type: 'keyword', + }, + reindexTaskPercComplete: { + type: 'float', + }, + runningReindexCount: { + type: 'integer', + }, + reindexOptions: { + properties: { + openAndClose: { + type: 'boolean', + }, + queueSettings: { + properties: { + queuedAt: { + type: 'long', + }, + startedAt: { + type: 'long', + }, + }, + }, + }, + }, }, }, }; From 3115da036b178e354af68a6642074b0875b19059 Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Tue, 28 Apr 2020 07:24:48 -0700 Subject: [PATCH 8/8] Fix mistake in merge conflict resolution in which legacy siem is imported. --- x-pack/index.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/x-pack/index.js b/x-pack/index.js index eb1c79267d1e3..fe4c325405933 100644 --- a/x-pack/index.js +++ b/x-pack/index.js @@ -16,7 +16,6 @@ import { spaces } from './legacy/plugins/spaces'; import { canvas } from './legacy/plugins/canvas'; import { infra } from './legacy/plugins/infra'; import { taskManager } from './legacy/plugins/task_manager'; -import { siem } from './legacy/plugins/siem'; import { uptime } from './legacy/plugins/uptime'; import { encryptedSavedObjects } from './legacy/plugins/encrypted_saved_objects'; import { actions } from './legacy/plugins/actions'; @@ -38,7 +37,6 @@ module.exports = function(kibana) { canvas(kibana), infra(kibana), taskManager(kibana), - siem(kibana), uptime(kibana), encryptedSavedObjects(kibana), actions(kibana),