mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
## Summary This PR adds a technical control to prevent incompatible mappings changes. These include: 1. Removing mapped fields. For the foreseeable future we require that teams only introduce new fields - in short: this avoids the "reindex" step in our migrations. 2. Changing the type of a field. We leverage ES to determine whether a given set of mappings can be applied "on top" of another. Similarly, this avoids the "reindex" step in migrations. The above checks depend on a snapshot of the mappings from `main`, these are the "current" mappings and are extracted from plugin code. This PR will bootstrap `main` with an initial set of mappings extracted from plugins (bulk of new lines added). ## The new CLI See the added `README.md` for details on how the CLI works. ## How will it work? Any new PR that introduces compatible mappings changes will result in a new snapshot being captured, then merged to main for other PRs to merge and run the same checks against (currently committing new snapshots happens in the CI check so there is no manual step of maintaining the snapshot). ## Additional We should consider combining this CI check with the existing check in `src/core/server/integration_tests/saved_objects/migrations/check_registered_types.test.ts`. Hopefully we can automate the check such that no manual review is needed from Core, not sure how we might cover the hash of the non-mappings related fields. We could consider narrowing the Jest test to exclude mappings. ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: spalger <spencer@elastic.co>
10 lines
432 B
JavaScript
10 lines
432 B
JavaScript
/*
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
* Side Public License, v 1.
|
|
*/
|
|
|
|
require('../src/setup_node_env');
|
|
require('@kbn/check-mappings-update-cli');
|