How to cast type in Scripted Field


#1

I'm trying to create a scripted field so that I can perform some arithmetic.

I have the following field, which is currently a string: 'UCD-SNMP-MIB::memTotalReal.0.keyword'.

I want to convert that to an integer to do calculations so I went about to creating a scripted field and the Script syntax is:

cast:'('int')' memTotalReal = doc['UCD-SNMP-MIB::memTotalReal.0.keyword'].value;

but kept getting compile error.

Trying to use Painless scripting and following the doc but it's not helping.


(Tyler Smalley) #2

Only numeric, boolean, date, and geo_point fields may be accessed. You will want to index the value as a numeric type.


(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.