-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Split the .kibana saved objects index into multiple indices #154888
Conversation
…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.
…ltiple SO indices (#154884) Part of #154888 There are a bunch of FTR and integration tests that interact with the SO indices directly, assuming there are only two SO indices: `.kibana` and `.kibana_task_manager`. The goal of this PR is to factorise that knowledge and make these tests use a list of SO indices instead.
…154882) Part of #154888 ES archiver logic assumes that there are only two SO indices: '.kibana' and '.kibana_task_manager'. This PR updates ES archiver so that it works with a list of SO indices instead. --------- Co-authored-by: pgayvallet <[email protected]>
…#155035) ## Summary As part of #154888, we need to stop making direct requests to the index `.kibana`, and use the SO Clients instead. This PR changes the utility `getSavedObjectsCount` to use aggregations in the SO client. ### 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 ### For maintainers - [x] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) I'm pointing to `main` because it's an improvement we needed anyway. --------- Co-authored-by: kibanamachine <[email protected]>
… to use the correct index (#155155) ### **this PR is targeting the `dot-kibana-split` feature branch and not `main`** ## Summary Part of #154888 In #154888, we're going to split the `.kibana` savedObject index into multiple ones. For this reason, calls to `core.savedObjects.getKibanaIndex` will not necessarily return the correct value (e.g types that were moved out of this index) This PR introduces the following SO APIs: - `getDefaultIndex` - `getIndexForType` - `getIndicesForTypes` - `getAllIndices` And adapt plugins code to replace usages of `core.savedObjects.getKibanaIndex` with the proper alternative
….kibana_alerting_cases` (#154897) ## Summary **This is targeting a feature branch** Part of #154888 This PR aims at moving the following saved object types to a new `.kibana_alerting_cases ` system index: - action - action_task_params - alert - api_key_pending_invalidation - cases - cases-comments - cases-configure - cases-connector-mappings - cases-telemetry - cases-user-actions - connector_token - rules-settings --------- Co-authored-by: Christos Nasikas <[email protected]> Co-authored-by: pgayvallet <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
security-defend-workflows changes LGTM, we have one PR to remove index: false
which would conflict with this, but we can resolve conflicts there after this PR goes in since it would be minimal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this work @gsoldevila, looks good for the timeline SO's! Just a question on whether or not QA teams have been looped in for additional testing? I'm not sure how prepared our teams are to test for any potential regressions while also managing any existing 8.8 feature work during the upcoming FF?
They have been, yes. If you think that a particular area is more at risk because of this PR, please feel free to inform us and/or QA. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ML changes tested and LGTM
## Summary **This is targeting a feature branch** Part of #154888 Following some remarks and feedback from the [feature branch PR](#154888), this PR aims at relocating some of the SO types: - Move `'url'` type back to `.kibana`. (related [comment](#154888 (comment)))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🌔 🚀 ✨ LGTM ✨ 🚀 🌔
Thanks for letting us know! Whoever merges last should update the "dynamic" mappings.json (there's 8 of them), to get rid of the removed type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
security-solution-platform changes LGTM.
I did wonder if there are any traces of the .siem-notification
SO. That one is part of the legacy security solution actions and didn't see it listed.
EDIT: It's an alert
SO
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]Module Count
Public APIs missing comments
Async chunks
Public APIs missing exports
Page load bundle
Saved Objects .kibana field count
Unknown metric groupsAPI count
ESLint disabled line counts
References to deprecated APIs
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
Documentation must reflect changes brought by the [dot kibana split](#154888). Our public facing documentation just mentions two indices e.g. https://www.elastic.co/guide/en/kibana/8.8/saved-object-migrations.html https://www.elastic.co/guide/en/kibana/8.8/resolve-migrations-failures.html#upgrade-migrations-old-indices this one in particular mentions that "all other indices are safe to delete".
Documentation must reflect changes brought by the [dot kibana split](elastic#154888). Our public facing documentation just mentions two indices e.g. https://www.elastic.co/guide/en/kibana/8.8/saved-object-migrations.html https://www.elastic.co/guide/en/kibana/8.8/resolve-migrations-failures.html#upgrade-migrations-old-indices this one in particular mentions that "all other indices are safe to delete". (cherry picked from commit 70eb9d3)
… (#158270) # Backport This will backport the following commits from `main` to `8.8`: - [Update saved objects migrations documentation for 8.8.0 (#158241)](#158241) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Gerard Soldevila","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-05-23T13:53:52Z","message":"Update saved objects migrations documentation for 8.8.0 (#158241)\n\nDocumentation must reflect changes brought by the [dot kibana\r\nsplit](https://github.com/elastic/kibana/pull/154888).\r\n\r\nOur public facing documentation just mentions two indices e.g.\r\n\r\nhttps://www.elastic.co/guide/en/kibana/8.8/saved-object-migrations.html\r\n\r\nhttps://www.elastic.co/guide/en/kibana/8.8/resolve-migrations-failures.html#upgrade-migrations-old-indices\r\nthis one in particular mentions that \"all other indices are safe to\r\ndelete\".","sha":"70eb9d3ecbb11768d091fca385bad4f20960deef","branchLabelMapping":{"^v8.9.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Core","release_note:skip","documentation","Feature:Migrations","backport:prev-minor","v8.8.0","v8.9.0","v8.8.1"],"number":158241,"url":"https://github.com/elastic/kibana/pull/158241","mergeCommit":{"message":"Update saved objects migrations documentation for 8.8.0 (#158241)\n\nDocumentation must reflect changes brought by the [dot kibana\r\nsplit](https://github.com/elastic/kibana/pull/154888).\r\n\r\nOur public facing documentation just mentions two indices e.g.\r\n\r\nhttps://www.elastic.co/guide/en/kibana/8.8/saved-object-migrations.html\r\n\r\nhttps://www.elastic.co/guide/en/kibana/8.8/resolve-migrations-failures.html#upgrade-migrations-old-indices\r\nthis one in particular mentions that \"all other indices are safe to\r\ndelete\".","sha":"70eb9d3ecbb11768d091fca385bad4f20960deef"}},"sourceBranch":"main","suggestedTargetBranches":["8.8"],"targetPullRequestStates":[{"branch":"8.8","label":"v8.8.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.9.0","labelRegex":"^v8.9.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/158241","number":158241,"mergeCommit":{"message":"Update saved objects migrations documentation for 8.8.0 (#158241)\n\nDocumentation must reflect changes brought by the [dot kibana\r\nsplit](https://github.com/elastic/kibana/pull/154888).\r\n\r\nOur public facing documentation just mentions two indices e.g.\r\n\r\nhttps://www.elastic.co/guide/en/kibana/8.8/saved-object-migrations.html\r\n\r\nhttps://www.elastic.co/guide/en/kibana/8.8/resolve-migrations-failures.html#upgrade-migrations-old-indices\r\nthis one in particular mentions that \"all other indices are safe to\r\ndelete\".","sha":"70eb9d3ecbb11768d091fca385bad4f20960deef"}}]}] BACKPORT--> Co-authored-by: Gerard Soldevila <[email protected]>
Documentation must reflect changes brought by the [dot kibana split](elastic#154888). Our public facing documentation just mentions two indices e.g. https://www.elastic.co/guide/en/kibana/8.8/saved-object-migrations.html https://www.elastic.co/guide/en/kibana/8.8/resolve-migrations-failures.html#upgrade-migrations-old-indices this one in particular mentions that "all other indices are safe to delete".
Description
Fix #104081
This PR move some of the SO types from the
.kibana
index into the following ones:.kibana_alerting_cases
.kibana_analytics
.kibana_security_solution
.kibana_ingest
This split/reallocation will occur during the
8.8.0
Kibana upgrade (meaning: from any version older than8.8.0
to any version greater or equal to8.8.0
)This PR main changes are:
.kibana
and usage of thecore.savedObjects.getKibanaIndex()
to use new APIs to target the correct index/indicesTo reviewers
Overall estimated risk of regressions: low
But, still, please take the time to review changes in your code. The parts of the production code that were the most impacted are the telemetry collectors, as most of them were performing direct requests against the
.kibana
index, so we had to adapt them. Most other contributor-owned changes are in FTR tests and datasets.If you think a type is misplaced (either we missed some types that should be moved to a specific index, or some types were moved and shouldn't have been) please tell us, and we'll fix the reallocation either in this PR or in a follow-up.
.Kibana split
The following new indices are introduced by this PR, with the following SO types being moved to it. (any SO type not listed here will be staying in its current index)
Note: The complete type => index breakdown is available in this spreadsheet.
.kibana_alerting_cases
.kibana_security_solution
.kibana_analytics
.kibana_ingest
Tasks / PRs
Sub-PRs
Implementation
indexTypesMap
#154892core.savedObjects.getKibanaIndex
to use the correct index #155155Individual index split
.kibana_alerting_cases
#154897.kibana_security_solution
#155129.kibana_analytics
#155140.kibana_ingest
#155130Improvements / follow-ups
getCurrentIndexTypesMap
resillient to intermittent failures Allow relocating SO to different indices during migration #154151 (comment)getSavedObjectsCount
] UsesoClient
instead of.kibana
searches #155035Reallocation tweaks
Tweaks to the reallocation can be done after the initial merge, as long as it's done before the public release of 8.8
url
should get back to.kibana
(see comment)Release Note
For performance purposes, Kibana is now using more system indices to store its internal data.
The following system indices will be created when upgrading to
8.8.0
:.kibana_alerting_cases
.kibana_analytics
.kibana_security_solution
.kibana_ingest