Kibana Line Chart - Average - Limit input to range or min/max

Hi,

looked now quiet a while though the forum, but without success. Only thing close was Average Aggregation

I am looking for a way to exclude values from averaging.

Lets say we have a line chart temperature over time. Temperature can go from -50 to 200. In case of errors the sensor value might be 65535. I still like to have the y axis adapted automatically to the current data range, but want to exclude the 65535 from the graph.
Maybe the "JSON input" can do this, but I did not find documentation that helped me.

Thanks!

Kibana Version 7.3.1

Hi,

Couple of things to note:
This is an example of our JSON inpuy:
JSON Input

A text field where you can add specific JSON-formatted properties to merge with the aggregation definition, as in the following example:

{ "script" : "doc['grade'].value * 1.2" }

Also this is from our docs: In Elasticsearch releases 1.4.3 and later, this functionality requires you to enable dynamic Groovy scripting.

https://www.elastic.co/guide/en/kibana/current/metric-chart.html

This is another example: {"script" : { "source" : "if(doc['geo.src'] == 'CN') return 0; else return 1"}}

Let me know if it works.

Thanks,
Bhavya

Hi Bhavya,

took me a moment to get it right, but yes, this works now in the 'JSON input' filed under Metrics > Y-axis:

{"script" : { "source" : "if(doc['ir'].value < 100) return doc['ir'].value; else return 1"}}

(But only with your answer. I have to say, the the Elastic Documentation is something that only helps to find things that you once knew. It is not helpful to gain new knowledge.)

Thanks you!!

That is very helpful feedback Bastian.

Will pass it on.

Thanks,
Bhavya