Hi All,
Due to a mapping mistake I have a number field mapped as a string. I have updated my mapping already to integer so that is fixed. Due to the amount of indices and the amount of data is re-indexing not an option. To move forward I want to add an scripted field that converts the string to an int.
Trough a scripted field in kibana I try the following:
if (doc['rcptto_count.keyword'] && !doc['rcptto_count.keyword'].empty) { return Integer.parseInt(doc['rcptto_count.keyword'].value); } else { return null;}
However this results in an error:
Caused by: org.elasticsearch.common.io.stream.NotSerializableExceptionWrapper: class_cast_exception: org.elasticsearch.index.fielddata.ScriptDocValues$Strings cannot be cast to java.lang.Boolean
at org.elasticsearch.painless.Def.DefToboolean(Def.java:626) ~[?:?]
at org.elasticsearch.painless.PainlessScript$Script.execute(if (doc['rcptto_count.keyword'] && !doc['rcptto_count.keyword'].empty) { return Integer.parseInt(doc['rcptto_count.keyword'].value); } else { return null;}:8) ~[?:?]
Could someone help me out here in a solution?