From 19e63ebb2ece043fa27e5b7d395f6c2fb39b78a7 Mon Sep 17 00:00:00 2001 From: Rudolf Meijering Date: Wed, 18 Jan 2023 11:23:44 +0100 Subject: [PATCH] Remove unused type maps-telemetry --- ...grations_state_action_machine.test.ts.snap | 30 +++++++++++++++++++ .../src/core/unused_types.ts | 2 ++ .../src/initial_state.test.ts | 5 ++++ .../migrations/7.7.2_xpack_100k.test.ts | 2 +- .../migrations/check_registered_types.test.ts | 15 +++++----- .../saved_objects/setup_saved_objects.ts | 17 ----------- 6 files changed, 45 insertions(+), 26 deletions(-) diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/__snapshots__/migrations_state_action_machine.test.ts.snap b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/__snapshots__/migrations_state_action_machine.test.ts.snap index 4e19c9bf62690..8f779a6f1977c 100644 --- a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/__snapshots__/migrations_state_action_machine.test.ts.snap +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/__snapshots__/migrations_state_action_machine.test.ts.snap @@ -76,6 +76,11 @@ Object { "type": "guided-setup-state", }, }, + Object { + "term": Object { + "type": "maps-telemetry", + }, + }, Object { "term": Object { "type": "ml-telemetry", @@ -257,6 +262,11 @@ Object { "type": "guided-setup-state", }, }, + Object { + "term": Object { + "type": "maps-telemetry", + }, + }, Object { "term": Object { "type": "ml-telemetry", @@ -442,6 +452,11 @@ Object { "type": "guided-setup-state", }, }, + Object { + "term": Object { + "type": "maps-telemetry", + }, + }, Object { "term": Object { "type": "ml-telemetry", @@ -631,6 +646,11 @@ Object { "type": "guided-setup-state", }, }, + Object { + "term": Object { + "type": "maps-telemetry", + }, + }, Object { "term": Object { "type": "ml-telemetry", @@ -862,6 +882,11 @@ Object { "type": "guided-setup-state", }, }, + Object { + "term": Object { + "type": "maps-telemetry", + }, + }, Object { "term": Object { "type": "ml-telemetry", @@ -1054,6 +1079,11 @@ Object { "type": "guided-setup-state", }, }, + Object { + "term": Object { + "type": "maps-telemetry", + }, + }, Object { "term": Object { "type": "ml-telemetry", diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/unused_types.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/unused_types.ts index 7dbcf2c270ba4..b5b0647d141a9 100644 --- a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/unused_types.ts +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/unused_types.ts @@ -39,6 +39,8 @@ export const REMOVED_TYPES: string[] = [ 'ui-counter', // Deprecated, no longer used since 7.13 https://github.com/elastic/kibana/pull/94923/files 'application_usage_transactional', + // Removed in 7.8.1 / 7.9.0 https://github.com/elastic/kibana/pull/69871 + 'maps-telemetry', ].sort(); // When migrating from the outdated index we use a read query which excludes diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/initial_state.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/initial_state.test.ts index 35d22e69f724e..91ef32f609536 100644 --- a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/initial_state.test.ts +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/initial_state.test.ts @@ -113,6 +113,11 @@ describe('createInitialState', () => { "type": "guided-setup-state", }, }, + Object { + "term": Object { + "type": "maps-telemetry", + }, + }, Object { "term": Object { "type": "ml-telemetry", diff --git a/src/core/server/integration_tests/saved_objects/migrations/7.7.2_xpack_100k.test.ts b/src/core/server/integration_tests/saved_objects/migrations/7.7.2_xpack_100k.test.ts index a90291d1614a4..4922223015904 100644 --- a/src/core/server/integration_tests/saved_objects/migrations/7.7.2_xpack_100k.test.ts +++ b/src/core/server/integration_tests/saved_objects/migrations/7.7.2_xpack_100k.test.ts @@ -29,7 +29,7 @@ async function removeLogFile() { } /** Number of SO documents dropped during the migration because they belong to an unused type */ -const UNUSED_SO_COUNT = 4; +const UNUSED_SO_COUNT = 5; describe('migration from 7.7.2-xpack with 100k objects', () => { let esServer: TestElasticsearchUtils; diff --git a/src/core/server/integration_tests/saved_objects/migrations/check_registered_types.test.ts b/src/core/server/integration_tests/saved_objects/migrations/check_registered_types.test.ts index 569e8b81afd2d..674dd55bb7f21 100644 --- a/src/core/server/integration_tests/saved_objects/migrations/check_registered_types.test.ts +++ b/src/core/server/integration_tests/saved_objects/migrations/check_registered_types.test.ts @@ -57,7 +57,7 @@ describe('checking migration metadata changes on all registered SO types', () => Object { "action": "7858e6d5a9f231bf23f6f2e57328eb0095b26735", "action_task_params": "bbd38cbfd74bf6713586fe078e3fa92db2234299", - "alert": "f2e81863be0b50966b876b88b906c962e30b8c9c", + "alert": "f4767f8699442d563c2975830f740906d62cffbd", "api_key_pending_invalidation": "9b4bc1235337da9a87ef05a1d1f4858b2a3b77c6", "apm-indices": "ceb0870f3a74e2ffc3a1cd3a3c73af76baca0999", "apm-server-schema": "2bfd2998d3873872e1366458ce553def85418f91", @@ -70,7 +70,7 @@ describe('checking migration metadata changes on all registered SO types', () => "canvas-workpad": "4b05f7829bc805bbaa07eb9fc0d2a2bbbd6bbf39", "canvas-workpad-template": "d4bb65aa9c4a2b25029d3272fd9c715d8e4247d7", "cases": "a27d57e75e358349a6ba835152fd4de0033a7bff", - "cases-comments": "d7c4c1d24e97620cd415e27e5eb7d5b5f2c5b461", + "cases-comments": "6c7a572e75db9336274a6b7d372667cb44f4aaad", "cases-configure": "1afc414f5563a36e4612fa269193d3ed7277c7bd", "cases-connector-mappings": "4b16d440af966e5d6e0fa33368bfa15d987a4b69", "cases-telemetry": "16e261e7378a72acd0806f18df92525dd1da4f37", @@ -85,7 +85,7 @@ describe('checking migration metadata changes on all registered SO types', () => "endpoint:user-artifact": "f94c250a52b30d0a2d32635f8b4c5bdabd1e25c0", "endpoint:user-artifact-manifest": "8c14d49a385d5d1307d956aa743ec78de0b2be88", "enterprise_search_telemetry": "fafcc8318528d34f721c42d1270787c52565bad5", - "epm-packages": "7d80ba3f1fcd80316aa0b112657272034b66d5a8", + "epm-packages": "61c34aed078aac04f5cd572162d4f761d6e62a66", "epm-packages-assets": "9fd3d6726ac77369249e9a973902c2cd615fc771", "event_loop_delays_daily": "d2ed39cf669577d90921c176499908b4943fb7bd", "exception-list": "fe8cc004fd2742177cdb9300f4a67689463faf9c", @@ -105,7 +105,7 @@ describe('checking migration metadata changes on all registered SO types', () => "ingest-agent-policies": "54d586fdafae83ba326e47d1a3727b0d9c910a12", "ingest-download-sources": "1e69dabd6db5e320fe08c5bda8f35f29bafc6b54", "ingest-outputs": "29181ecfdc7723f544325ecef7266bccbc691a54", - "ingest-package-policies": "d93048bf153f9043946e8965065a88014f7ccb41", + "ingest-package-policies": "598cb46d731b4447bdee94659b4821c0c37f84a9", "ingest_manager_settings": "6f36714825cc15ea8d7cda06fde7851611a532b4", "inventory-view": "bc2bd1e7ec7c186159447ab228d269f22bd39056", "kql-telemetry": "29544cd7d3b767c5399878efae6bd724d24c03fd", @@ -113,7 +113,6 @@ describe('checking migration metadata changes on all registered SO types', () => "lens": "236ecd358ed3a4ecfc03ed676d958b64acf0b697", "lens-ui-telemetry": "df2844565c9e18fed2bdb1f6cc3aadd58cf1e45b", "map": "00ca6c4cf46ae59f70f1436262eb9f457b45eb14", - "maps-telemetry": "5adbde35bd50ec2b8e9ea5b96d4d9f886e31ecfb", "metrics-explorer-view": "09e56993352b8ee678e88f71e4410d9aeee72f3a", "ml-job": "2836da98a81bd220db61c0549e8e28da7a876cb2", "ml-module": "95055522c8406afa67a554690a43506f6c040744", @@ -123,11 +122,11 @@ describe('checking migration metadata changes on all registered SO types', () => "osquery-pack": "a2d675c7af4208e54a5b28d23d324d7c599a5491", "osquery-pack-asset": "de8783298eb33a577bf1fa0caacd42121dcfae91", "osquery-saved-query": "7b213b4b7a3e59350e99c50e8df9948662ed493a", - "query": "4640ef356321500a678869f24117b7091a911cb6", + "query": "e9d18422d3df74e366e68d5e6fd977219309d14d", "rules-settings": "1af4c9abd4b40a154e233c2af4867df7aab7ac24", "sample-data-telemetry": "8b10336d9efae6f3d5593c4cc89fb4abcdf84e04", - "search": "c48f5ab5d94545780ea98de1bff9e39f17f3606b", - "search-session": "ba383309da68a15be3765977f7a44c84f0ec7964", + "search": "a8d45880d9ce712e8e9a4aa46f5dc5963731d526", + "search-session": "012cf49851285c03c89bfd2c6535449282bc785d", "search-telemetry": "beb3fc25488c753f2a6dcff1845d667558712b66", "security-rule": "e0dfdba5d66139d0300723b2e6672993cd4a11f3", "security-solution-signals-migration": "e65933e32926e0ca385415bd44fc6da0b6d3d419", diff --git a/x-pack/plugins/maps/server/saved_objects/setup_saved_objects.ts b/x-pack/plugins/maps/server/saved_objects/setup_saved_objects.ts index c75f1f322e25c..126ec9851c905 100644 --- a/x-pack/plugins/maps/server/saved_objects/setup_saved_objects.ts +++ b/x-pack/plugins/maps/server/saved_objects/setup_saved_objects.ts @@ -61,23 +61,6 @@ export function setupSavedObjects( ); }, }); - - /* - * The maps-telemetry saved object type isn't used, but in order to remove these fields from - * the mappings we register this type with `type: 'object', enabled: true` to remove all - * previous fields from the mappings until https://github.com/elastic/kibana/issues/67086 is - * solved. - */ - core.savedObjects.registerType({ - name: 'maps-telemetry', - hidden: false, - namespaceType: 'agnostic', - mappings: { - // @ts-ignore Core types don't support this since it's only really valid when removing a previously registered type - type: 'object', - enabled: false, - }, - }); } /**