-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Generating terms using a script #1910
Comments
You can use the JSON input in the aggregations, but only when you are querying the same field you selected in the builder since If you're looking for script fields, #1537 and #1755 cover this, and are being worked on now. Can you provide your specific use case here though? What you aggregation looks like and what you're trying to do with the JSON input could be useful. |
My use case was trying to work around #1911 where I had empty aggregations that I wanted to show. The workaround idea was to aggregate over a field value, but if it didn't exist return a default value instead, so the bucket would never be empty with something like: { "script" : "doc['gender'].value ?: 'unknown'" } If I understand correctly, this is pretty much what those issues talk about. |
Tried the following JSON input as a simple test of generating terms using a script in the visualize aggregation builder:
but got a fatal error (GroovyScriptExecutionException[ArrayIndexOutOfBoundsException[null]. I think this is because Kibana is still sending the term field, which should be omitted with this kind of script.
I did get a value script to work:
The text was updated successfully, but these errors were encountered: