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

Cancel discarded KQL value suggestion requests #51411

Merged
merged 9 commits into from
Dec 9, 2019

Conversation

lukasolson
Copy link
Member

@lukasolson lukasolson commented Nov 22, 2019

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:

  • Actually cancel the request on the server side

Checklist

Use strikethroughs to 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.

@lukasolson lukasolson added Feature:Search Querying infrastructure in Kibana Feature:KQL KQL Team:AppArch labels Nov 22, 2019
@lukasolson lukasolson requested a review from a team as a code owner November 22, 2019 00:12
@lukasolson lukasolson self-assigned this Nov 22, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-arch (Team:AppArch)

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 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 }) {
Copy link
Contributor

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);
Copy link
Contributor

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?

Copy link
Contributor

@lizozom lizozom left a 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

@lukasolson
Copy link
Member Author

@elasticmachine merge upstream

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

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

@lukasolson lukasolson merged commit 25c750b into elastic:master Dec 9, 2019
lukasolson added a commit to lukasolson/kibana that referenced this pull request Dec 9, 2019
* Fix filter matches index for filters with partial meta

* Abort discarded KQL value suggestion requests

* Abort server-side connection to ES

* Fix failing test
@lukasolson
Copy link
Member Author

7.x (7.6.0): 80d35bd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[KQL] [Filter editor] Cancel discarded requests for suggestions
4 participants