Using aggregation Json Input field to filter values

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?

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

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

Thanks for coming back and posting your solution!