Skip to content
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

[ILM] Replace legacy ES client with the new client #78416

Merged
merged 13 commits into from
Oct 12, 2020

Conversation

yuliacech
Copy link
Contributor

@yuliacech yuliacech commented Sep 24, 2020

Summary

Fixes #77906.
This PR removes all usage of LegacyAPICaller and replaces it with ElasticsearchClient in ILM server code. There are some changes in how the new client handles/returns ES errors, so further work is needed to update es_ui_shared.isEsError function (#79678).

Todo

@yuliacech
Copy link
Contributor Author

@elasticmachine merge upstream

@yuliacech yuliacech added chore Feature:ILM release_note:skip Skip the PR/issue when compiling release notes Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more v7.10.0 v8.0.0 labels Oct 6, 2020
@yuliacech yuliacech marked this pull request as ready for review October 6, 2020 15:13
@yuliacech yuliacech requested a review from a team as a code owner October 6, 2020 15:13
@elasticmachine
Copy link
Contributor

Pinging @elastic/es-ui (Team:Elasticsearch UI)

Copy link
Contributor

@alisonelizabeth alisonelizabeth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job @yuliacech! Thanks for working on this. I did a quick smoke test of ILM and did not notice any regressions. I also assume the API integration tests would have caught any issues.

I left a comment in the code regarding the use of isEsError.

Also, per the migration docs, I think you can migrate the functional tests from using const client = getService('legacyEs'); to const client = getService('es');.

I also just want to confirm this work is intended for 7.10, given FF is today?

return response.ok();
} catch (e) {
if (lib.isEsError(e)) {
if (e instanceof ResponseError) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are other instances of lib.isEsError being used throughout the server code - do they need to be updated as well?

@yuliacech yuliacech added v7.11.0 and removed v7.10.0 labels Oct 6, 2020
@yuliacech
Copy link
Contributor Author

@elasticmachine merge upstream

@yuliacech
Copy link
Contributor Author

@elasticmachine merge upstream

@yuliacech
Copy link
Contributor Author

Hi @alisonelizabeth,
thanks a lot for your code review! I moved the PR to 7.11 and updated the api integration code to use the new client as well. Would you mind having another look please?

Copy link
Contributor

@alisonelizabeth alisonelizabeth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Latest changes LGTM. Thanks @yuliacech! I did not test again.

There are some changes in how the new client handles/returns ES errors, so further work is needed to update es_ui_shared.isEsError function (#79678).

This is not blocking, but I wonder if it's worth adding support for the way the new client handles errors soon rather than later, and rename the existing is_es_error to is_es_error_legacy (or something to that effect). Once everything is migrated, we could remove the legacy file. Otherwise, it seems like we potentially have to go back and replace if (e.name === 'ResponseError') with if (lib.isEsError(e)) throughout the code, rather than just updating the file path.


const indexLifecycleDataEnricher = async (
indicesList: IndexWithoutIlm[],
// TODO replace deprecated ES client after Index Management is updated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this TODO! It may also be worth adding a comment to #73973 as a reminder to circle back around to this.

@yuliacech
Copy link
Contributor Author

@elasticmachine merge upstream

1 similar comment
@yuliacech
Copy link
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

distributable file count

id before after diff
default 48453 48452 -1

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@yuliacech
Copy link
Contributor Author

thank you for the review, @alisonelizabeth ! I agree about addressing is_es_error as soon as possible, but would like not do that in this PR. I'll create a follow up PR this week.

@yuliacech yuliacech merged commit 21c3e04 into elastic:master Oct 12, 2020
yuliacech added a commit that referenced this pull request Oct 13, 2020
* [ILM] Replace legacy ES client with the new client

* [ILM] Fix type check errors

* [ILM] Fix api integration test

* [ILM] Update error handling and integration test for the new client

* [ILM] Fix api integration test

* [ILM] Fix api integration test

* [ILM] Add a todo comment for Index Management plugin extension

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
@yuliacech yuliacech deleted the ilm_elasticsearch_client branch February 24, 2021 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Feature:ILM release_note:skip Skip the PR/issue when compiling release notes Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more v7.11.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ILM] Migrate server code to new Elasticsearch client
4 participants