Hi, I have a script below -
if(doc['not_shipped_shortfall'].value < 0) { return doc['not_shipped_shortfall'].value; }else{ return 0; }
when I click 'preview results' I see my desired result and looks like the script is working fine. However, when I try to use this metric in the visualizer I get the following error -
org.elasticsearch.index.fielddata.ScriptDocValues$Doubles.get(ScriptDocValues.java:249)
org.elasticsearch.index.fielddata.ScriptDocValues$Doubles.getValue(ScriptDocValues.java:243)
if(doc['not_shipped_shortfall'].value < 0.0) {
^---- HERE
I'd greatly appreciate if you can point me in the right direction.
Can you please tell us additional information: what elastic version are you using? and also paste the whole stack trace, there is a reason field at the bottom of the error.
and I can use the new_field created in a vizualisation:
Thanks Marone, I am currently using elastic version 7.10.
How can I find the whole stack trace? The error message I pasted was copied when I try to use it in a visualization.
Something to also note that is that the field I am working with has a mapping type of double. Fortunately, all the numbers in that field are/can only whole numbers. Not sure if that changes anything.
I updated the mapping to double and still working.
For the whole stacktrace I thought it was printed from Elasticsearch side, but since you got it when trying to make the vizualisation, the code is executed on the kibana side.
Do you have the new field processed on Discover tab? Like this:
Yes, I am able to see the values on the discover tab. I am not able to use this field on my visualization though. That's what is confusing me. Any hints or tips that you might have?
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.