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

[kql] Creating filters with numeric scripted fields sends incorrect type #98761

Closed
lukasolson opened this issue Apr 29, 2021 · 2 comments · Fixed by #99554
Closed

[kql] Creating filters with numeric scripted fields sends incorrect type #98761

lukasolson opened this issue Apr 29, 2021 · 2 comments · Fixed by #99554
Assignees
Labels
bug Fixes for quality problems that affect the customer experience Feature:KQL KQL PR sent SharedUX/fix-it-week Bugs that have been groomed and queued up for the team's next fix it week

Comments

@lukasolson
Copy link
Member

Kibana version: 7.12

Describe the bug:

Upgrading to 7.12 from 7.11.2 causes errors when trying to use previously defined scripted fields in queries.

For example, I calculate the length of a DNS query from my Zeek logs in Filebeat by creating a scripted field called "dns.question.length" defined as:

if (doc.containsKey('dns.question.name') && doc['dns.question.name'].size()!=0 ) {
return doc['dns.question.name'].value.length()
}
return 0

This will still calculate and display correctly in the "Discover" view when I open a log for viewing. However, if I try to run a search query in "Discover" like dns.question.length > 50 to find any DNS queries larger than a length of 50, I get shard errors:

{
"took": 13,
"timed_out": false,
"_shards": {
"total": 4,
"successful": 3,
"skipped": 3,
"failed": 1,
"failures": [
{
"shard": 0,
"index": "filebeat-7.12.0-2021.03.24-000001",
"node": "Qr7gcGRRQTaNvm0PLGP8ig",
"reason": {
"type": "script_exception",
"reason": "runtime error",
"script_stack": [
"return s.get() > v}",
" ^---- HERE"
],
"script": "boolean gt(Supplier s, def v) {return s.get() > v}gt(() -> { if (doc.containsKey('dns.question.name') && doc['dns.question.name'].size()!=0 ) { ...",
"lang": "painless",
"position": {
"offset": 39,
"start": 31,
"end": 50
},
"caused_by": {
"type": "class_cast_exception",
"reason": "Cannot apply [>] operation to types [java.lang.Integer] and [java.lang.String]."
}
}
}
]
},
"hits": {
"total": 0,
"max_score": 0,
"hits": []
}
}

Expected behavior:

The parameter would be sent as a numeric, rather than a string. We also need to verify whether or not the same is true for runtime fields.

Caused by #93658.

@lukasolson lukasolson added bug Fixes for quality problems that affect the customer experience Feature:KQL KQL Team:AppServices SharedUX/fix-it-week Bugs that have been groomed and queued up for the team's next fix it week labels Apr 29, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-services (Team:AppServices)

@lukasolson lukasolson self-assigned this Apr 29, 2021
@marius-dr
Copy link
Member

^ this work fine with runtime fields. Just tested it today when an user asked on Discuss about scripted fields.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:KQL KQL PR sent SharedUX/fix-it-week Bugs that have been groomed and queued up for the team's next fix it week
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants