Using aggregation Json Input field to filter values


#1

I'm trying to create a visualization on Kibana showing the average value of a field on a date histogram.
In order to have a "smooth" average, I'd like to have a ceiling of 100 for said value.
Using this json

{ "script": "ceil(100) ", "lang" : "groovy" }

the graph is ploted with all the values at 100. What am I doing wrong?


#2

It wasn't working because I was using the wrong method.
This is the solution:

{ "script": "min(doc['field'].value, 100)", "lang" : "groovy" }


(Lee Drengenberg) #3

Thanks for coming back and posting your solution!


(system) #4