-
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
Namespaces can be lost when importing multi-NS objects #164454
Labels
bug
Fixes for quality problems that affect the customer experience
Feature:Saved Objects
Team:Core
Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc
Comments
pgayvallet
added
bug
Fixes for quality problems that affect the customer experience
Team:Core
Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc
Feature:Saved Objects
labels
Aug 22, 2023
Pinging @elastic/kibana-core (Team:Core) |
pgayvallet
changed the title
Namespaces can be lost when importing some types of multi-NS objects
Namespaces can be lost when importing multi-NS objects
Aug 22, 2023
Merged
1 task
For instance, on Creating an index-pattern via POST /api/saved_objects/index-pattern/id-1
{
"attributes": {}
} creates the following document: {
"_index": ".kibana_analytics_8.11.0_001",
"_id": "index-pattern:id-1",
"_score": 2.5314267,
"_source": {
"index-pattern": {},
"type": "index-pattern",
"references": [],
"managed": false,
"namespaces": [
"not-default"
],
"coreMigrationVersion": "8.8.0",
"typeMigrationVersion": "8.0.0", // <-- good
"updated_at": "2023-08-22T14:17:08.526Z",
"created_at": "2023-08-22T14:17:08.526Z"
}
}, when importing {
"type":"index-pattern",
"id":"logs-*",
"attributes":{"title":"logs-*","timeFieldName":"@timestamp","allowNoIndex":true},
"references":[]
} creates {
"_index": ".kibana_analytics_8.11.0_001",
"_id": "index-pattern:logs-*",
"_score": 2.5314267,
"_source": {
"index-pattern": {
"title": "logs-*",
"timeFieldName": "@timestamp",
"allowNoIndex": true
},
"type": "index-pattern",
"references": [],
"managed": true,
"namespaces": [
"not-default"
],
"coreMigrationVersion": "8.8.0",
"typeMigrationVersion": "7.11.0", // <-- wrong
"updated_at": "2023-08-22T14:11:57.708Z",
"created_at": "2023-08-22T14:11:57.708Z"
}
}, |
juliaElastic
added a commit
that referenced
this issue
Aug 22, 2023
…ation version setting (#164456) ## Summary Closes #164243 Added a `typeMigrationVersion: '8.0.0'` to index patterns until #164454 is fixed. Related to #161969 Feedback from kibana core team, we should always set the migration version fields, even if `migrationVersion` is not set. It would be good to backport this to 8.9 too. How to test locally: - create a test space - install system integration in test space - restart kibana - verify that the index patterns `logs-*`, `metrics-*` are still in test space in Data Views UI ### Checklist - [ ] [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
kibanamachine
pushed a commit
to kibanamachine/kibana
that referenced
this issue
Aug 22, 2023
…ation version setting (elastic#164456) ## Summary Closes elastic#164243 Added a `typeMigrationVersion: '8.0.0'` to index patterns until elastic#164454 is fixed. Related to elastic#161969 Feedback from kibana core team, we should always set the migration version fields, even if `migrationVersion` is not set. It would be good to backport this to 8.9 too. How to test locally: - create a test space - install system integration in test space - restart kibana - verify that the index patterns `logs-*`, `metrics-*` are still in test space in Data Views UI ### Checklist - [ ] [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 (cherry picked from commit 433d4f2)
kibanamachine
added a commit
that referenced
this issue
Aug 22, 2023
…ix migration version setting (#164456) (#164484) # Backport This will backport the following commits from `main` to `8.10`: - [[Fleet] Fix index patterns being recreated in default space, fix migration version setting (#164456)](#164456) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Julia Bardi","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-08-22T16:55:17Z","message":"[Fleet] Fix index patterns being recreated in default space, fix migration version setting (#164456)\n\n## Summary\r\n\r\nCloses https://github.com/elastic/kibana/issues/164243\r\nAdded a `typeMigrationVersion: '8.0.0'` to index patterns until\r\nhttps://github.com//issues/164454 is fixed.\r\n\r\nRelated to https://github.com/elastic/kibana/pull/161969\r\nFeedback from kibana core team, we should always set the migration\r\nversion fields, even if `migrationVersion` is not set.\r\n\r\nIt would be good to backport this to 8.9 too.\r\n\r\nHow to test locally:\r\n\r\n- create a test space\r\n- install system integration in test space\r\n- restart kibana\r\n- verify that the index patterns `logs-*`, `metrics-*` are still in test\r\nspace in Data Views UI\r\n\r\n### Checklist\r\n\r\n- [ ] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios","sha":"433d4f21c39fa7c364e3275443f673360dda5d18","branchLabelMapping":{"^v8.11.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","v8.10.0","v8.11.0","v8.9.2"],"number":164456,"url":"https://github.com/elastic/kibana/pull/164456","mergeCommit":{"message":"[Fleet] Fix index patterns being recreated in default space, fix migration version setting (#164456)\n\n## Summary\r\n\r\nCloses https://github.com/elastic/kibana/issues/164243\r\nAdded a `typeMigrationVersion: '8.0.0'` to index patterns until\r\nhttps://github.com//issues/164454 is fixed.\r\n\r\nRelated to https://github.com/elastic/kibana/pull/161969\r\nFeedback from kibana core team, we should always set the migration\r\nversion fields, even if `migrationVersion` is not set.\r\n\r\nIt would be good to backport this to 8.9 too.\r\n\r\nHow to test locally:\r\n\r\n- create a test space\r\n- install system integration in test space\r\n- restart kibana\r\n- verify that the index patterns `logs-*`, `metrics-*` are still in test\r\nspace in Data Views UI\r\n\r\n### Checklist\r\n\r\n- [ ] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios","sha":"433d4f21c39fa7c364e3275443f673360dda5d18"}},"sourceBranch":"main","suggestedTargetBranches":["8.10","8.9"],"targetPullRequestStates":[{"branch":"8.10","label":"v8.10.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.11.0","labelRegex":"^v8.11.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/164456","number":164456,"mergeCommit":{"message":"[Fleet] Fix index patterns being recreated in default space, fix migration version setting (#164456)\n\n## Summary\r\n\r\nCloses https://github.com/elastic/kibana/issues/164243\r\nAdded a `typeMigrationVersion: '8.0.0'` to index patterns until\r\nhttps://github.com//issues/164454 is fixed.\r\n\r\nRelated to https://github.com/elastic/kibana/pull/161969\r\nFeedback from kibana core team, we should always set the migration\r\nversion fields, even if `migrationVersion` is not set.\r\n\r\nIt would be good to backport this to 8.9 too.\r\n\r\nHow to test locally:\r\n\r\n- create a test space\r\n- install system integration in test space\r\n- restart kibana\r\n- verify that the index patterns `logs-*`, `metrics-*` are still in test\r\nspace in Data Views UI\r\n\r\n### Checklist\r\n\r\n- [ ] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios","sha":"433d4f21c39fa7c364e3275443f673360dda5d18"}},{"branch":"8.9","label":"v8.9.2","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Julia Bardi <[email protected]>
juliaElastic
added a commit
to juliaElastic/kibana
that referenced
this issue
Aug 23, 2023
…ation version setting (elastic#164456) Closes elastic#164243 Added a `typeMigrationVersion: '8.0.0'` to index patterns until elastic#164454 is fixed. Related to elastic#161969 Feedback from kibana core team, we should always set the migration version fields, even if `migrationVersion` is not set. It would be good to backport this to 8.9 too. How to test locally: - create a test space - install system integration in test space - restart kibana - verify that the index patterns `logs-*`, `metrics-*` are still in test space in Data Views UI - [ ] [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
2 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Fixes for quality problems that affect the customer experience
Feature:Saved Objects
Team:Core
Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc
Related to #164243
Types that were moved from
single
tomultiple
namespace types during8.0.0
can loose their namespace information when being imported without type version specified (which is the case for assets installed by fleet packages), if they don't define any migration for an higher version.We confirmed from #164243 that
index-pattern
is impacted, but there may be others.Basically, if for a given type,
convertToMultiNamespaceTypeVersion
is set and is higher than the latest registeredmigration
, as it is the case forindex-pattern
:kibana/src/plugins/data_views/server/saved_objects/data_views.ts
Line 19 in 21351df
kibana/src/plugins/data_views/server/saved_objects/index_pattern_migrations.ts
Lines 60 to 64 in ca2d1d6
Then, when imported without specifying
typeMigrationVersion
, the latestmigration
version is set on the document (e.g7.11.0
).Which causes the migration system to pickup the document for migration at next restart, which tries to reapply the "convert to multi-NS" migration again, causing the existing
namespaces
field to be erased and replaced with the default value of[ "default" ]
.However, when creating a document of the type using the
create
API, the max of the two values is correctly used (e.g8.0.0
forindex-pattern
), so the behavior betweenimport
andcreate
seems different here. This could be related to the usage of theconvertNamespaceTypes
option?The text was updated successfully, but these errors were encountered: