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

Fixes KQL autocomplete suggestions with IP fields #154111

Merged
merged 4 commits into from
Mar 31, 2023

Conversation

lukasolson
Copy link
Member

Summary

Resolves #140266.

Fixes KQL autocomplete suggestions when using an IP field. (Only works when the selected value suggestion method is terms_enum, not terms_agg.)

Checklist

Release note

KQL autocomplete suggestions now support IP-type fields when the advanced setting, autocomplete:valueSuggestionMethod, is set to terms_enum.

@lukasolson lukasolson added release_note:fix Feature:KQL KQL Team:DataDiscovery Discover App Team (Document Explorer, Saved Search, Surrounding documents, Graph) v8.8.0 labels Mar 30, 2023
@lukasolson lukasolson requested a review from a team as a code owner March 30, 2023 22:15
@lukasolson lukasolson self-assigned this Mar 30, 2023
@lukasolson lukasolson requested a review from a team as a code owner March 30, 2023 22:15
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)

Copy link
Contributor

@stratoula stratoula left a comment

Choose a reason for hiding this comment

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

This is awesome Lukas! Changes LGTM, I tested it locally in Chrome and ip suggestions work like a charm :)

Copy link
Contributor

@jughosta jughosta left a comment

Choose a reason for hiding this comment

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

Works great! Thanks, Lukas 👍

Comment on lines 102 to 103
const [field] = stubFields.filter(
({ type, aggregatable }) => type === 'string' && aggregatable
({ type, aggregatable }) => (type === 'string' || type === 'ip') && aggregatable
Copy link
Contributor

@jughosta jughosta Mar 31, 2023

Choose a reason for hiding this comment

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

Would it be helpful to also call await getValueSuggestions({...}) separately for a string field and for an ip field then? And check that http.fetch was called twice.

Copy link
Member Author

Choose a reason for hiding this comment

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

Addressed in 0e2c81f.

src/plugins/data/server/ui_settings.ts Outdated Show resolved Hide resolved
@lukasolson lukasolson enabled auto-merge (squash) March 31, 2023 20:43
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
unifiedSearch 33.5KB 33.5KB +15.0B
Unknown metric groups

ESLint disabled line counts

id before after diff
securitySolution 432 435 +3

Total ESLint disabled count

id before after diff
securitySolution 512 515 +3

History

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

cc @lukasolson

@lukasolson lukasolson merged commit c7114d2 into elastic:main Mar 31, 2023
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Mar 31, 2023
@rockdaboot
Copy link
Contributor

Thank you so much @lukasolson !

Just a comment for future readers: ::1 (IPv6 localhost) is not be auto-suggested.
I believe it only affects testing on local stacks, so not sure if this requires a fix.

danielmitterdorfer added a commit that referenced this pull request Apr 20, 2023
Previously we had mapped host ips as keywords as well as ips in order to
work around #140266. This has been fixed with #154111 so we can rely on
the IP field and remove the duplicate.

Relates #154111
Relates #140266
nikitaindik pushed a commit to nikitaindik/kibana that referenced this pull request Apr 25, 2023
Previously we had mapped host ips as keywords as well as ips in order to
work around elastic#140266. This has been fixed with elastic#154111 so we can rely on
the IP field and remove the duplicate.

Relates elastic#154111
Relates elastic#140266
@gchaps gchaps mentioned this pull request Apr 25, 2023
19 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:KQL KQL release_note:fix Team:DataDiscovery Discover App Team (Document Explorer, Saved Search, Surrounding documents, Graph) v8.8.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[KQL] Improve support for 'ip' type fields
7 participants