-
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
Elasticsearch legacy compatible api #41468
Elasticsearch legacy compatible api #41468
Conversation
💚 Build Succeeded |
💚 Build Succeeded |
Pinging @elastic/kibana-platform |
*/ | ||
public asScoped(request?: KibanaRequest | LegacyRequest | FakeRequest) { |
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.
Should we tag it as a breaking change? I found only Security
plugin uses this API, although I could miss a plugin that is in progress of the migration.
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.
Yes we definitely should. There are at least 3 or 4 new in-development plugins. Let's add it to this issue #40768
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.
done
💚 Build Succeeded |
docs/development/core/server/kibana-plugin-server.clusterclient.callwithrequest.md
Outdated
Show resolved
Hide resolved
💔 Build Failed |
ACK: Reviewing... |
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.
Changes in Spaces and Security plugins look good to me assuming this is what we really want. But before we move forward with these changes can you please clarify the following things for me?
-
What is the main motivation behind these changes and what problem are we trying to solve here? Issue description is a bit ters on that.
-
If the current core
ElasticsearchService
API conflicts with the one we'll have once we migrate to the newelasticsearch-js
lib, then how the new API will look like? I thought that once we advance with more and more "scoped" or "context-bound" services provided by the core we'll end up with something likecallAsInternalUser
andcallAsCurrentUser
anyway, and consumers won't need to callasScoped
manually (most of the time at least). But I'm out of the loop here, sorry if you need to explain that multiple times 🙈 -
In general, why the core public API is going to change with the new version of the 3rd-party lib we use under the hood (
elasticsearch-js
lib)? Aren't we trying to augment consumers from rawelasticsearch-js
lib and provide stable interfaces/contracts that don't neceserrily need to change if underlying lib changes? Are we planning to incorporate new major versions ofelasticsearch-js
client only within new major versions of Kibana as well? As far as I understandelasticsearch-js
is still relatively independent or we have plans to converge APIs ofElasticSearchService
andelasticsearch-js
somehow?
I had a brief conversation with @restrry over Slack and I've got that with these changes we're trying to simplify migration of the legacy plugins to the new platform. But it's still not immediately clear to me in what ways these changes do that since we already have a legacy elasticsearch
plugin that serves exactly that purpose. I mean people will still need to change the way they receive cluster client(s), probably adapt to new error types, update tests to use new platform mocks (while migrating Security to NP that caused the main pain I believe cause we had lots of tests to update), etc.
So the only win I see here is that we'll keep same method names and their signatures (for callWithRequest
only, callAsInternalUser
and callWithInternalUser
have the same signature already), but it doesn't feel like a huge one in the grand scheme of things unless I'm missing something.
Having said that, I'm not opposed to what you've done here, just want to have a better understanding of the plan you have 🙂
Thanks a lot!
closed until we agree on the final design and outline the whole migration plan. |
Summary
There is a plan to migrate from https://github.com/elastic/elasticsearch-js-legacy to the new https://github.com/elastic/elasticsearch-js client. Their interfaces are not compatible and migration will require additional work.
The current implementation of the Elasticsearch service introduced another version of the API. Thus, a plugin migrated to New Platform Elasticsearch Service has to adapt to the new API twice:
elasticsearch-js
.This PR make New Platform Elasticsearch API compatible with LegacyPlatform to avoid double work for plugins in the future.
Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.[ ] This was checked for cross-browser compatibility, including a check against IE11[ ] Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support[ ] Documentation was added for features that require explanation or tutorials[ ] This was checked for keyboard-only and screenreader accessibilityFor maintainers