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

Fix value method on ip scripts #61230

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
WIP
  • Loading branch information
nik9000 committed Aug 17, 2020
commit 2992093e5cce4bae67bc447181cd5010127a49a7
Original file line number Diff line number Diff line change
@@ -111,6 +111,24 @@ setup:
- match: {aggregations.ip.buckets.1.key: 26.1.0.0}
- match: {aggregations.ip.buckets.1.doc_count: 1}

---
"use in scripts":
- do:
search:
index: http_logs
body:
aggs:
ip:
terms:
script:
String v = doc['ip'].value;
return v.substring(0, v.indexOf('.') - 1);
- match: {hits.total.value: 6}
- match: {aggregations.ip.buckets.0.key: 247}
- match: {aggregations.ip.buckets.0.doc_count: 2}
- match: {aggregations.ip.buckets.1.key: 26}
- match: {aggregations.ip.buckets.1.doc_count: 1}

---
"term query":
- do: