-
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
Cancel discarded KQL value suggestion requests #51411
Conversation
Pinging @elastic/kibana-app-arch (Team:AppArch) |
💔 Build Failed |
💔 Build Failed |
💔 Build Failed |
💔 Build Failed |
💚 Build Succeeded |
@@ -22,7 +22,7 @@ export const kueryProvider = ({ config, indexPatterns, boolFilter }) => { | |||
return provider({ config, indexPatterns, boolFilter }); | |||
}); | |||
|
|||
return function getSuggestions({ query, selectionStart, selectionEnd }) { | |||
return function getSuggestions({ query, selectionStart, selectionEnd, signal }) { |
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.
// nit
Can\will the signal be used for anything but aborting?
If not, maybe call it abortSignal?
@@ -112,7 +112,7 @@ describe('Kuery value suggestions', function () { | |||
const spy = jest.spyOn(npStart.plugins.data, 'getSuggestions'); | |||
await getSuggestions({ fieldName, prefix, suffix }); | |||
expect(spy).toHaveBeenCalledTimes(1); | |||
expect(spy).toBeCalledWith(expect.any(String), expect.any(Object), prefix + suffix, undefined); | |||
expect(spy).toBeCalledWith(expect.any(String), expect.any(Object), prefix + suffix, undefined, undefined); |
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.
Maybe add a test where signal
is defined as well?
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.
Added a couple of minor comments.
Anyway tested on Ubuntu / Chrome (using network throttling) and LGTM
@elasticmachine merge upstream |
💚 Build SucceededTo update your PR or re-run it, just comment with: |
* Fix filter matches index for filters with partial meta * Abort discarded KQL value suggestion requests * Abort server-side connection to ES * Fix failing test
7.x (7.6.0): 80d35bd |
Summary
Resolves #48797.
This PR cancels requests initiating from the KQL query bar for value suggestions when a new request is made. This should eliminate much of the extra load in large clusters when requests take longer than the time it takes to type a new character.
To do:
Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.For maintainers
Release notes
When querying Elasticsearch for value suggestions on specific fields in KQL, we will now cancel any previous, incomplete requests for value suggestions.