I'm unable to perform a basic division of two fields on Kibana. First, I tried to do so in a Line Chart bu using the Advanced Json Input section with this script: {"script": "if(doc['kpi.abc'].value > 0) then {(doc['kpi.def'].value / doc['kpi.abc'].value)*100}"}
but I received 'esaggs' error.
When I tried to create a scripted field in the index using these codes:
if (doc['kpi.abc'].value > 0) {
return (doc['kpi.def'].value / doc['kpi.abc'].value);
}
There are probably documents in your index which don't have a value for kpi.NLAPAG1LOTOT - make sure to only access values in documents where they exist by appending this to the script:
Hey, thanks for the response. I've implemented your suggestion and am using this code in my line chart visualisation, but still facing an issue with it : esaggs error
The script in advanced json won't work, the scripted field is the right approach here. Please add a similar check for the kpi.NLAPAG1LOTOT and remove the script from advanced json (just select the scripted field from the dropdown)
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.