Reindex service - rename rest api url paths#233532
Merged
mattkime merged 12 commits intolookup_reindex_servicefrom Sep 4, 2025
Merged
Reindex service - rename rest api url paths#233532mattkime merged 12 commits intolookup_reindex_servicefrom
mattkime merged 12 commits intolookup_reindex_servicefrom
Conversation
mattkime
commented
Sep 3, 2025
x-pack/platform/plugins/private/reindex_service/public/src/reindex_service.ts
Outdated
Show resolved
Hide resolved
…elastic/kibana into lookup_reindex_service_reindex_url_path
Contributor
|
Pinging @elastic/kibana-management (Team:Kibana Management) |
Contributor
Author
|
/ci |
Contributor
💚 Build Succeeded
Metrics [docs]Public APIs missing comments
Page load bundle
History
cc @mattkime |
mattkime
added a commit
that referenced
this pull request
Sep 4, 2025
… apis (#230475) Note - #233532 builds on top of this PR and its the PR you want to run to test the code. The PRs were kept separate for clarity. --- Previously it was assumed that if you were reindexing it could only be in the service of upgrading. Now Upgrade Assistant is responsible for using the reindexing service for upgrading and the reindexing service is agnostic of any upgrade concerns. This PR does the following - 1) Reindexing APIs need to be told the name of the new index (previously it was calculated) 2) Creates a ReindexServerWrapper which aims to be a simplified API. Previously there were a couple of different classes/functions which in combination created a CRUD api but this wraps them all together to provide a simpler API. The dependencies are passed to instantiate the API and then the useful apis are returned. There are separate internal and external apis, internal mainly pertains to lifecycle and general housekeeping while external api is for CRUD operations. 3) Supports passing the type of index to be created 4) Removal of old index is optional, if its removed an alias points from old to new index. ``` ReindexService.reindex({ indexName: 'kibanaIndex', newIndexName: 'kibanaIndexReindexed', settings: { mode: 'lookup' }, reindexOptions: { deleteOldIndex: true }, }); ``` ``` POST kbn:/api/upgrade_assistant/reindex { "indexName" : "kibana_sample_data_flights", "newIndexName" : "ksdf", "settings": { "mode": "lookup" }, "reindexOptions": { "deleteOldIndex": false, // defaults to false } } ``` To test upgrade assistant, follow directions here - #228705 Mock data here - https://github.com/elastic/kibana/pull/230021/files#diff-f7eb2d7fe666aad1bedcd73d356612d2f74f81c76ba2e8e26b2983b9fb92a661R49 Follow ups - - This PR removes rest api integration tests that were previously disabled. We should consider how we might implement these. - `cleanupReindexOperations` is called when the user visits the Upgrade Assistant page. This doesn't really have a place in the general purpose reindexing service. Ideally the reindex job saved objects would simply be removed when the task is complete but this would require a close examination of the reindex saved object lifecycle which is outside the scope of this PR. - Address Upgrade Assistant flyout missing new index name - Ideally the reindexing service would be completely agnostic of version concerns but deep within the reindexing code it looks at which index settings should be removed when migrating to version 8. This should be an Upgrade Assistant concern BUT this change is outside of the scope of this PR. <img width="508" height="820" alt="Screenshot 2025-09-03 at 12 21 21 AM" src="https://github.com/user-attachments/assets/ed478a13-b1ac-4d0f-826e-5ebf5b9641c0" /> --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Ignacio Rivas <rivasign@gmail.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Cesare de Cal <cesare.decal@elastic.co>
ymao1
pushed a commit
to ymao1/kibana
that referenced
this pull request
Sep 4, 2025
… apis (elastic#230475) Note - elastic#233532 builds on top of this PR and its the PR you want to run to test the code. The PRs were kept separate for clarity. --- Previously it was assumed that if you were reindexing it could only be in the service of upgrading. Now Upgrade Assistant is responsible for using the reindexing service for upgrading and the reindexing service is agnostic of any upgrade concerns. This PR does the following - 1) Reindexing APIs need to be told the name of the new index (previously it was calculated) 2) Creates a ReindexServerWrapper which aims to be a simplified API. Previously there were a couple of different classes/functions which in combination created a CRUD api but this wraps them all together to provide a simpler API. The dependencies are passed to instantiate the API and then the useful apis are returned. There are separate internal and external apis, internal mainly pertains to lifecycle and general housekeeping while external api is for CRUD operations. 3) Supports passing the type of index to be created 4) Removal of old index is optional, if its removed an alias points from old to new index. ``` ReindexService.reindex({ indexName: 'kibanaIndex', newIndexName: 'kibanaIndexReindexed', settings: { mode: 'lookup' }, reindexOptions: { deleteOldIndex: true }, }); ``` ``` POST kbn:/api/upgrade_assistant/reindex { "indexName" : "kibana_sample_data_flights", "newIndexName" : "ksdf", "settings": { "mode": "lookup" }, "reindexOptions": { "deleteOldIndex": false, // defaults to false } } ``` To test upgrade assistant, follow directions here - elastic#228705 Mock data here - https://github.com/elastic/kibana/pull/230021/files#diff-f7eb2d7fe666aad1bedcd73d356612d2f74f81c76ba2e8e26b2983b9fb92a661R49 Follow ups - - This PR removes rest api integration tests that were previously disabled. We should consider how we might implement these. - `cleanupReindexOperations` is called when the user visits the Upgrade Assistant page. This doesn't really have a place in the general purpose reindexing service. Ideally the reindex job saved objects would simply be removed when the task is complete but this would require a close examination of the reindex saved object lifecycle which is outside the scope of this PR. - Address Upgrade Assistant flyout missing new index name - Ideally the reindexing service would be completely agnostic of version concerns but deep within the reindexing code it looks at which index settings should be removed when migrating to version 8. This should be an Upgrade Assistant concern BUT this change is outside of the scope of this PR. <img width="508" height="820" alt="Screenshot 2025-09-03 at 12 21 21 AM" src="https://github.com/user-attachments/assets/ed478a13-b1ac-4d0f-826e-5ebf5b9641c0" /> --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Ignacio Rivas <rivasign@gmail.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Cesare de Cal <cesare.decal@elastic.co>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/api/upgrade_assistant=>/api/reindex_servicewhere appropriateSo the url matches the api name. A cleanup step after a lot of refactoring