[Upgrade Assistant] Better handling of closed indices#58890
[Upgrade Assistant] Better handling of closed indices#58890jloleysens merged 33 commits intoelastic:masterfrom
Conversation
Using _cluster/state is considered internal. This adds an integration test for checking the contract in CI.
|
Pinging @elastic/es-ui (Team:Elasticsearch UI) |
Updated the handling of reindexOptions to make it more backwards compatible (treat it as if it could be undefined). Also update the logic for checking for open or closed indices. No optional chaining! It should break if the response does not exactly match.
Rather check for the specific value we want, as this is what is also gauranteed by the tests. In this way, the information we send back to the client is also more accurate regarding the index status. If, in future, more index states are introduced this will need to be revisited if it affects the ability for an index to be re-indexed.
|
@elasticmachine merge upstream |
|
@elasticmachine merge upstream |
|
@elasticmachine merge upstream |
alisonelizabeth
left a comment
There was a problem hiding this comment.
@jloleysens great work! Tested locally with stubbed data.
I had a few UX suggestions/questions. Let me know what you think.
- The alert icon feels a little weird to me. At first, I was thinking the icon should be next to the index name, but I understand why you put it next to the button. Another thought I had was to change the reindex button color to
warningin this scenario. Thoughts? You should still be able to keep the tooltip.
I also was not expecting the icon to be a link to documentation until I read through the code, but this is probably a user error on my part.
-
Would it be beneficial to include the same warning on the reindex flyout?
-
Do the "Reindexing process" steps on the reindex flyout need to be modified at all?
There was a problem hiding this comment.
Is it worth having a quick conversation with an ES engineer to confirm this is the correct approach?
There was a problem hiding this comment.
I spoke with @DaveCTurner about this and we concluded that _cluster/state is probably the best place to get information about closed indices.
Should keep us on top of any changes that may happen to that response.
...tant/public/application/components/tabs/checkup/deprecations/reindex/closed_warning_icon.tsx
Outdated
Show resolved
Hide resolved
alisonelizabeth
left a comment
There was a problem hiding this comment.
LGTM. Thanks for makings those changes! I left one copy suggestion, but nothing blocking.
...sistant/public/application/components/tabs/checkup/deprecations/reindex/flyout/container.tsx
Outdated
Show resolved
Hide resolved
Reindexing test was generating index name, could just get it from server response. Also removed openAndClose from all integration tests
|
@elasticmachine merge upstream |
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
* Exclude disallowed, private setting at index creation * Remove intl from tabs component * Added logic for checking the current index status * Added ES contract integration test Using _cluster/state is considered internal. This adds an integration test for checking the contract in CI. * Add the client side notification for closed indices * First version of end-to-end functionality working * Clean up unused, incorrect type information * Fix type issues and added a comment about the new reindex options * Fixed server side tests, added comments and logic updates Updated the handling of reindexOptions to make it more backwards compatible (treat it as if it could be undefined). Also update the logic for checking for open or closed indices. No optional chaining! It should break if the response does not exactly match. * Clean up unused code * Improved idempotency of test and check explicitly for "close". Rather check for the specific value we want, as this is what is also gauranteed by the tests. In this way, the information we send back to the client is also more accurate regarding the index status. If, in future, more index states are introduced this will need to be revisited if it affects the ability for an index to be re-indexed. * Update client-side tests * Fix types * Handle a case where the index name provided may be an alias * Fix types * merge-conflict: finish merge conflict resolution * Update x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/deprecations/reindex/closed_warning_icon.tsx Co-Authored-By: Alison Goryachev <alisonmllr20@gmail.com> * merge-conflict: Remove duplicate import VSCode does not auto-save as expected :sigh: * ui: Revisit the UI Moved the warning icon to inside of the button and tooltip to on the button. Added a callout to the reindex flyout for when an index is closed. * logic: slight update to when the index closed callout is shown We only show the index closed callout in the flyout when the reindex operation is not considered "completed" * tests: fix jest tests * refactor: remove "openAndClose" from reindex endpoints "openAndClose" should just happen automatically. The user should not have to pass the flag in, that would be a weird API. We just need to warn the user about that reindexing a closed index will take more resources * test: update upgrade assistant integration test * fix: types * copy: use sentence case * refactor: use the in scope declaration of reindex op * test: Clean up tests Reindexing test was generating index name, could just get it from server response. Also removed openAndClose from all integration tests Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Alison Goryachev <alisonmllr20@gmail.com> # Conflicts: # x-pack/plugins/upgrade_assistant/common/types.ts # x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/deprecations/cell.tsx # x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/deprecations/index_table.tsx # x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/deprecations/list.test.tsx # x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/deprecations/list.tsx # x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/deprecations/reindex/button.tsx # x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/deprecations/reindex/flyout/checklist_step.test.tsx # x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/deprecations/reindex/flyout/checklist_step.tsx # x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/deprecations/reindex/flyout/container.tsx # x-pack/plugins/upgrade_assistant/server/lib/__snapshots__/es_migration_apis.test.ts.snap # x-pack/plugins/upgrade_assistant/server/lib/reindexing/reindex_service.ts
* master: (22 commits) Generate docs from data plugin (elastic#56955) Fixes elastic#59513 by hiding one of the symmetric edges rather than omiting it (elastic#59514) Harden creation of child processes (elastic#55697) [Alerting] replace watcher http APIs used by index threshold Alerting (elastic#59475) [Maps][docs] add more details to Quantitative data driven styling docs (elastic#59553) chore: 🤖 hide Drilldowns in master (elastic#59698) [Discover] Migrate AppState/GlobalState to new app state helpers (elastic#57175) Use HTTP request schemas to create types, use those types in the client (elastic#59340) [Maps] Support categorical styling for numbers and dates (elastic#57908) [ML] Functional API tests - bucket span estimation with custom search.max_buckets (elastic#59665) Fix slm_ui setting by changing camel case back to snake case. (elastic#59663) removes beta tag (elastic#59618) [DOCS] Removed spatial references (elastic#59595) fix outdated docs (elastic#58729) [ML] Fixes bucket span estimators loading of max_buckets setting (elastic#59639) [ML] Refactoring anomaly detector job types (elastic#59556) [Upgrade Assistant] Better handling of closed indices (elastic#58890) additional visualizations plugin cleanup before moving to NP (elastic#59318) In scripted fields, unable to switch the `Type` - getting a console error which says - Class constructor DecoratedFieldFormat cannot be invoked without 'new' (elastic#59285) [Visualize] Remove global state in visualize (elastic#58352) ...
…s/kibana into alerting/fix-flaky-instance-test * 'alerting/fix-flaky-instance-test' of github.com:gmmorris/kibana: (176 commits) Generate docs from data plugin (elastic#56955) Fixes elastic#59513 by hiding one of the symmetric edges rather than omiting it (elastic#59514) Harden creation of child processes (elastic#55697) [Alerting] replace watcher http APIs used by index threshold Alerting (elastic#59475) [Maps][docs] add more details to Quantitative data driven styling docs (elastic#59553) chore: 🤖 hide Drilldowns in master (elastic#59698) [Discover] Migrate AppState/GlobalState to new app state helpers (elastic#57175) Use HTTP request schemas to create types, use those types in the client (elastic#59340) [Maps] Support categorical styling for numbers and dates (elastic#57908) [ML] Functional API tests - bucket span estimation with custom search.max_buckets (elastic#59665) Fix slm_ui setting by changing camel case back to snake case. (elastic#59663) removes beta tag (elastic#59618) [DOCS] Removed spatial references (elastic#59595) fix outdated docs (elastic#58729) [ML] Fixes bucket span estimators loading of max_buckets setting (elastic#59639) [ML] Refactoring anomaly detector job types (elastic#59556) [Upgrade Assistant] Better handling of closed indices (elastic#58890) additional visualizations plugin cleanup before moving to NP (elastic#59318) In scripted fields, unable to switch the `Type` - getting a console error which says - Class constructor DecoratedFieldFormat cannot be invoked without 'new' (elastic#59285) [Visualize] Remove global state in visualize (elastic#58352) ...
|
Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync. |
…59650) * [Upgrade Assistant] Better handling of closed indices (#58890) * Exclude disallowed, private setting at index creation * Remove intl from tabs component * Added logic for checking the current index status * Added ES contract integration test Using _cluster/state is considered internal. This adds an integration test for checking the contract in CI. * Add the client side notification for closed indices * First version of end-to-end functionality working * Clean up unused, incorrect type information * Fix type issues and added a comment about the new reindex options * Fixed server side tests, added comments and logic updates Updated the handling of reindexOptions to make it more backwards compatible (treat it as if it could be undefined). Also update the logic for checking for open or closed indices. No optional chaining! It should break if the response does not exactly match. * Clean up unused code * Improved idempotency of test and check explicitly for "close". Rather check for the specific value we want, as this is what is also gauranteed by the tests. In this way, the information we send back to the client is also more accurate regarding the index status. If, in future, more index states are introduced this will need to be revisited if it affects the ability for an index to be re-indexed. * Update client-side tests * Fix types * Handle a case where the index name provided may be an alias * Fix types * merge-conflict: finish merge conflict resolution * Update x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/deprecations/reindex/closed_warning_icon.tsx Co-Authored-By: Alison Goryachev <alisonmllr20@gmail.com> * merge-conflict: Remove duplicate import VSCode does not auto-save as expected :sigh: * ui: Revisit the UI Moved the warning icon to inside of the button and tooltip to on the button. Added a callout to the reindex flyout for when an index is closed. * logic: slight update to when the index closed callout is shown We only show the index closed callout in the flyout when the reindex operation is not considered "completed" * tests: fix jest tests * refactor: remove "openAndClose" from reindex endpoints "openAndClose" should just happen automatically. The user should not have to pass the flag in, that would be a weird API. We just need to warn the user about that reindexing a closed index will take more resources * test: update upgrade assistant integration test * fix: types * copy: use sentence case * refactor: use the in scope declaration of reindex op * test: Clean up tests Reindexing test was generating index name, could just get it from server response. Also removed openAndClose from all integration tests Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Alison Goryachev <alisonmllr20@gmail.com> # Conflicts: # x-pack/plugins/upgrade_assistant/common/types.ts # x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/deprecations/cell.tsx # x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/deprecations/index_table.tsx # x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/deprecations/list.test.tsx # x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/deprecations/list.tsx # x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/deprecations/reindex/button.tsx # x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/deprecations/reindex/flyout/checklist_step.test.tsx # x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/deprecations/reindex/flyout/checklist_step.tsx # x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/deprecations/reindex/flyout/container.tsx # x-pack/plugins/upgrade_assistant/server/lib/__snapshots__/es_migration_apis.test.ts.snap # x-pack/plugins/upgrade_assistant/server/lib/reindexing/reindex_service.ts * Merge: Resolve remaining merge conflicts Also updated existing Jest snapshots. * test: Update Jest snapshots and reference the 6.0 index The integration test on master is reference 7.0 because it aims toward helping users migrate from 7.0 -> 8.0. The 7.x branch is running 6.0 data as it helps migrate from older indices. * Remove test data 🤦🏼♂️ * Clean up Jest snapshot After removing the test data, this snapshot also needed to be updated Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
|
@jloleysens do I need to start from 5.6.16 to test this PR? Thanks! |
|
Hi @bhavyarm ! The PR description has a hacky version of to test the UI, but for an actual test we would need to load up a v7.7.0 stack (ES + Kibana) and have the following conditions met:
The upgrade assistant should now be able to both detect the need for reindexing and that the index is closed. Reindexing should still be possible, though. We just want to let the user know that we need to open the index and re-close it. |
…nhancements) (#213755) ## Summary The PR brings the following improvements to the UA ES deprecations flows: * Remove the "Reindex" option for _Frozen index_ deprecations that are related to a data stream's backing index (backing indices cannot be alias-based, see [thread](https://elastic.slack.com/archives/C08A04N8XHV/p1741017934359239)). * Propagate `"isClosedIndex"` information to the UI side, so that we can show a warning message in the reindex flows flyouts. The [original functionality](#58890) got lost in the woods. * Propagate `"isClosedIndex", "isFrozenIndex", "isReadonly"` properties as part of the `correctiveAction` details ONLY for _index_settings migrations_, instead of doing it as top level properties for all migrations. These properties did not make for most migration types. * Big refactor in `migrations.ts` file (server side). The logic for obtaining, filtering and enriching ES deprecations had become quite fragmented and hard to read. @Bamieh @jloleysens please take a close look at this one. * Improve existing type definitions.
…nhancements) (elastic#213755) ## Summary The PR brings the following improvements to the UA ES deprecations flows: * Remove the "Reindex" option for _Frozen index_ deprecations that are related to a data stream's backing index (backing indices cannot be alias-based, see [thread](https://elastic.slack.com/archives/C08A04N8XHV/p1741017934359239)). * Propagate `"isClosedIndex"` information to the UI side, so that we can show a warning message in the reindex flows flyouts. The [original functionality](elastic#58890) got lost in the woods. * Propagate `"isClosedIndex", "isFrozenIndex", "isReadonly"` properties as part of the `correctiveAction` details ONLY for _index_settings migrations_, instead of doing it as top level properties for all migrations. These properties did not make for most migration types. * Big refactor in `migrations.ts` file (server side). The logic for obtaining, filtering and enriching ES deprecations had become quite fragmented and hard to read. @Bamieh @jloleysens please take a close look at this one. * Improve existing type definitions. (cherry picked from commit f2ae059)
…other enhancements) (#213755) (#214386) # Backport This will backport the following commits from `8.x` to `8.18`: - [[UA] Do not allow reindexing data_stream backing indices (and other enhancements) (#213755)](#213755) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Gerard Soldevila","email":"gerard.soldevila@elastic.co"},"sourceCommit":{"committedDate":"2025-03-13T13:34:47Z","message":"[UA] Do not allow reindexing data_stream backing indices (and other enhancements) (#213755)\n\n## Summary\n\nThe PR brings the following improvements to the UA ES deprecations\nflows:\n\n* Remove the \"Reindex\" option for _Frozen index_ deprecations that are\nrelated to a data stream's backing index (backing indices cannot be\nalias-based, see\n[thread](https://elastic.slack.com/archives/C08A04N8XHV/p1741017934359239)).\n* Propagate `\"isClosedIndex\"` information to the UI side, so that we can\nshow a warning message in the reindex flows flyouts. The [original\nfunctionality](#58890) got lost in\nthe woods.\n* Propagate `\"isClosedIndex\", \"isFrozenIndex\", \"isReadonly\"` properties\nas part of the `correctiveAction` details ONLY for _index_settings\nmigrations_, instead of doing it as top level properties for all\nmigrations. These properties did not make for most migration types.\n* Big refactor in `migrations.ts` file (server side). The logic for\nobtaining, filtering and enriching ES deprecations had become quite\nfragmented and hard to read. @Bamieh @jloleysens please take a close\nlook at this one.\n* Improve existing type definitions.","sha":"f2ae05909dd81e3cc368173b350b331587a99d8d","branchLabelMapping":{"^v8.16.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Core","release_note:skip","backport:version","v8.18.0","v8.19.0"],"title":"[UA] Do not allow reindexing data_stream backing indices (and other enhancements)","number":213755,"url":"https://github.com/elastic/kibana/pull/213755","mergeCommit":{"message":"[UA] Do not allow reindexing data_stream backing indices (and other enhancements) (#213755)\n\n## Summary\n\nThe PR brings the following improvements to the UA ES deprecations\nflows:\n\n* Remove the \"Reindex\" option for _Frozen index_ deprecations that are\nrelated to a data stream's backing index (backing indices cannot be\nalias-based, see\n[thread](https://elastic.slack.com/archives/C08A04N8XHV/p1741017934359239)).\n* Propagate `\"isClosedIndex\"` information to the UI side, so that we can\nshow a warning message in the reindex flows flyouts. The [original\nfunctionality](#58890) got lost in\nthe woods.\n* Propagate `\"isClosedIndex\", \"isFrozenIndex\", \"isReadonly\"` properties\nas part of the `correctiveAction` details ONLY for _index_settings\nmigrations_, instead of doing it as top level properties for all\nmigrations. These properties did not make for most migration types.\n* Big refactor in `migrations.ts` file (server side). The logic for\nobtaining, filtering and enriching ES deprecations had become quite\nfragmented and hard to read. @Bamieh @jloleysens please take a close\nlook at this one.\n* Improve existing type definitions.","sha":"f2ae05909dd81e3cc368173b350b331587a99d8d"}},"sourceBranch":"8.x","suggestedTargetBranches":["8.18"],"targetPullRequestStates":[{"branch":"8.18","label":"v8.18.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT-->

Summary
Fix #41572
We use the
_cluster/stateendpoint to determine whether an index is open or closed. We inform the user in the UI but we still allow them to request a reindex with the understanding that the UA will open, reindex, alias and close the index again.How to test
x-pack/plugins/upgrade_assistant/server/lib/es_migration_apis.ts.test1,test2andtest3actually exist in the cluster. (e.g. in ConsolePUT test1etc).test1.POST /test1/_close(more information on this API here)test1. There should be an alert icon next to the button with some more information displayed on hover.GET _cluster/state/metadata/test1and check that thestatekey is stillclose.test2, this should work as before and leave the index inopenstate (use same step as above but for indextest2to verify).Release note
TODO
Additional information
Snippet:
Screenshots
Reindex Button state when index is closed
Flyout state (another callout, see emphasis)
Checklist
Delete any items that are not applicable to this PR.
For maintainers