-
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
[index_pattern_management]: Replace calls to /elasticsearch/_msearch
with internal route.
#77564
[index_pattern_management]: Replace calls to /elasticsearch/_msearch
with internal route.
#77564
Conversation
script_fields: { | ||
[name]: { | ||
script: { | ||
lang: 'painless', |
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.
I hardcoded painless
here because we removed support for expression based scripted fields awhile ago, thus eliminating the ability to edit existing scripted fields. As a result there was really no point in passing the lang
around, since you already can't preview a legacy expression
scripted field anyway.
.then((res) => ({ | ||
status: res.statusCode, | ||
hits: res.body.hits, | ||
})) | ||
.catch((err) => ({ | ||
status: err.statusCode, | ||
error: err.body.attributes.error, | ||
})); |
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.
Restructured the response to minimize the amount of changes I needed to make to the existing types that the UI relies on.
const { index, name, script, query, additionalFields } = request.body; | ||
|
||
try { | ||
const response = await client.search({ |
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.
Logic here was mostly ripped off from the existing code on the client, with some slight modifications.
Pinging @elastic/kibana-app-arch (Team:AppArch) |
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.
Thanks a lot for doing this, it will unblock #71927 and allow to finally get rid of the legacy es
plugin!
0846a09
to
7ccbac3
Compare
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.
code looks good and works well.
💚 Build SucceededBuild metricsasync chunks size
distributable file count
History
To update your PR or re-run it, just comment with: |
…` with internal route. (elastic#77564)
Closes #73993
Related to #55140
Summary
This removes the final usage of the
/elasticsearch/_msearch
endpoint in Kibana. It was being used by the Index Pattern Management UI when generating previews of scripted field results in the field editor.Changes include the following:
preview_scripted_field
route that's internal to theindex_pattern_management
plugin_search
instead of_msearch
, as I couldn't find any reason why_msearch
was actually necessary here (though I tested it with our recently added internal_msearch
route and it still worked)routes
directory inindex_pattern_management
and consolidates existingresolve_index
route there as well.Testing
No functional changes introduced here. To test, create a new scripted field and click the "preview" link from the editor. If the script is invalid, an error should be shown in the preview flyout, otherwise a preview should display as it did before.