Skip to content

Commit

Permalink
[dot-kibana-split] Update dynamic mappings.json to include the `index…
Browse files Browse the repository at this point in the history
…TypesMap` (#154892)

Part of #154888

Some mappings.json use a special `$KIBANA_PACKAGE_VERSION` variable.
ES archiver uses this variable to generate saved object indices with
names that match the current stack version.
Note that this a bit brittle, cause incompatible mappings changes would
break Kibana.
However, it allows skipping reindexing and saving some precious CI time
when running tests.

With the introduction of the .kibana split, the mappings `_meta`
information now contain a new property, called `indexTypesMap`, which
holds a list of the SO types that are part of each index.

If the list is not present, the migration logic assumes that the .kibana
index must be split (and its documents redistributed), and it forces a
reindex.

The goal of this PR is to enrich the `mappings.json` with that extra
property, so that the migrator logic will not trigger a reindex.

- Thus, these mappings must be updated whenever existing types are moved
to a separate index, or new types are added.
- Ideally, we should also update the corresponding `data.json` files, to
place each SO document to the appropriate index.
  • Loading branch information
gsoldevila authored Apr 18, 2023
1 parent e9ee758 commit e13e3cb
Show file tree
Hide file tree
Showing 11 changed files with 994 additions and 159 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,104 +28,104 @@ export const ALLOWED_CONVERT_VERSION = '8.0.0';
export const DEFAULT_INDEX_TYPES_MAP: IndexTypesMap = {
'.kibana_task_manager': ['task'],
'.kibana': [
'core-usage-stats',
'legacy-url-alias',
'config',
'config-global',
'usage-counters',
'guided-onboarding-guide-state',
'guided-onboarding-plugin-state',
'ui-metric',
'application_usage_totals',
'application_usage_daily',
'event_loop_delays_daily',
'url',
'index-pattern',
'sample-data-telemetry',
'space',
'spaces-usage-stats',
'exception-list-agnostic',
'exception-list',
'telemetry',
'file',
'fileShare',
'action',
'action_task_params',
'connector_token',
'query',
'kql-telemetry',
'search-session',
'search-telemetry',
'file-upload-usage-collection-telemetry',
'alert',
'api_key_pending_invalidation',
'rules-settings',
'search',
'tag',
'graph-workspace',
'visualization',
'dashboard',
'todo',
'apm-indices',
'apm-server-schema',
'apm-service-group',
'apm-telemetry',
'app_search_telemetry',
'application_usage_daily',
'application_usage_totals',
'book',
'searchableList',
'lens',
'lens-ui-telemetry',
'map',
'canvas-element',
'canvas-workpad',
'canvas-workpad-template',
'cases',
'cases-comments',
'cases-configure',
'cases-connector-mappings',
'cases',
'cases-user-actions',
'cases-telemetry',
'canvas-element',
'canvas-workpad',
'canvas-workpad-template',
'slo',
'ingest_manager_settings',
'ingest-agent-policies',
'ingest-outputs',
'ingest-package-policies',
'cases-user-actions',
'config',
'config-global',
'connector_token',
'core-usage-stats',
'csp-rule-template',
'dashboard',
'endpoint:user-artifact',
'endpoint:user-artifact-manifest',
'enterprise_search_telemetry',
'epm-packages',
'epm-packages-assets',
'fleet-preconfiguration-deletion-record',
'ingest-download-sources',
'event_loop_delays_daily',
'exception-list',
'exception-list-agnostic',
'file',
'file-upload-usage-collection-telemetry',
'fileShare',
'fleet-fleet-server-host',
'fleet-proxy',
'fleet-message-signing-keys',
'fleet-preconfiguration-deletion-record',
'fleet-proxy',
'graph-workspace',
'guided-onboarding-guide-state',
'guided-onboarding-plugin-state',
'index-pattern',
'infrastructure-monitoring-log-view',
'infrastructure-ui-source',
'ingest-agent-policies',
'ingest-download-sources',
'ingest-outputs',
'ingest-package-policies',
'ingest_manager_settings',
'inventory-view',
'kql-telemetry',
'legacy-url-alias',
'lens',
'lens-ui-telemetry',
'map',
'metrics-explorer-view',
'ml-job',
'ml-module',
'ml-trained-model',
'monitoring-telemetry',
'osquery-manager-usage-metric',
'osquery-saved-query',
'osquery-pack',
'osquery-pack-asset',
'csp-rule-template',
'ml-job',
'ml-trained-model',
'ml-module',
'uptime-dynamic-settings',
'synthetics-privates-locations',
'synthetics-monitor',
'uptime-synthetics-api-key',
'synthetics-param',
'siem-ui-timeline-note',
'siem-ui-timeline-pinned-event',
'siem-detection-engine-rule-actions',
'osquery-saved-query',
'query',
'rules-settings',
'sample-data-telemetry',
'search',
'search-session',
'search-telemetry',
'searchableList',
'security-rule',
'siem-ui-timeline',
'endpoint:user-artifact',
'endpoint:user-artifact-manifest',
'security-solution-signals-migration',
'infrastructure-ui-source',
'metrics-explorer-view',
'inventory-view',
'infrastructure-monitoring-log-view',
'upgrade-assistant-reindex-operation',
'siem-detection-engine-rule-actions',
'siem-ui-timeline',
'siem-ui-timeline-note',
'siem-ui-timeline-pinned-event',
'slo',
'space',
'spaces-usage-stats',
'synthetics-monitor',
'synthetics-param',
'synthetics-privates-locations',
'tag',
'telemetry',
'todo',
'ui-metric',
'upgrade-assistant-ml-upgrade-operation',
'monitoring-telemetry',
'enterprise_search_telemetry',
'app_search_telemetry',
'upgrade-assistant-reindex-operation',
'uptime-dynamic-settings',
'uptime-synthetics-api-key',
'url',
'usage-counters',
'visualization',
'workplace_search_telemetry',
'apm-indices',
'apm-telemetry',
'apm-server-schema',
'apm-service-group',
],
};
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export async function getIndicesInvolvedInRelocation({

export function indexMapToIndexTypesMap(indexMap: IndexMap): IndexTypesMap {
return Object.entries(indexMap).reduce<IndexTypesMap>((acc, [indexAlias, { typeMappings }]) => {
acc[indexAlias] = Object.keys(typeMappings);
acc[indexAlias] = Object.keys(typeMappings).sort();
return acc;
}, {});
}
Expand Down
Loading

0 comments on commit e13e3cb

Please sign in to comment.