Following right from the documentation:
hubEvent.rssi is a String like '-98 dBm'
I want to return a number
def rssi = doc['hubEvent.rssi.keyword'].value;
if (rssi != null)
{
int lastdBIndex = rssi.lastIndexOf('dB');
return Double.parseDouble(rssi.substring(lastdBIndex));
}
return null;
Following documentation here almost line for line
Yet I get an error as follows
Error executing Painless script: ' def rssi = doc['hubEvent.rssi.keyword'].value; ...'.
org.elasticsearch.index.fielddata.ScriptDocValues$Strings.get(ScriptDocValues.java:494)
org.elasticsearch.index.fielddata.ScriptDocValues$Strings.getValue(ScriptDocValues.java:508)
rssi = doc['hubEvent.rssi.keyword'].value;
^---- HERE
I have played around with all kinds of combos (String instead of 'def' which I don't understand but its in the docs with no explanation). In total frustration I just returned a string instead of a number where I just did
return doc['hubEvent.rssi.keyword'].value;
Worked like a charm. !!!???? !!! WTF???
I was hoping today's (March 7 Elastithon would provide some help). But it was all promotion. Kibana became a lot more difficult to work with after updating from 7.1.1 to 7.10.2. A lot more clicking to do the same things. Frustrating when you have issues like this to retry again and again.