Converting a text field to integer via painless or expression- impossible?

Hello,

I have been trying, for months, how to convert a text field to integer using painless, but everytime I try the whole index will not longer show when going to "Discover".

I have tried:

return Integer.parseInt(doc["kv.my_field"].value);

Any ideas? Also unfortunately the whole "painless" language is not really generating what the problem is...

Before people suggesting to redo the index by either making logstash convert the field to integer (which I can't, I have 8 months worth of data).

Also, the GUI shows that you can edit a field - but you can not edit the type of the field....

I have also tried using the "expression" option

Integer.parseInt(doc["kv.my_field"].value);

and

Float.parseFloat(doc["kv.my_field"].value);

Hi

The script looks correct from painless point of view. Are there any errors generated in the logs which you could share ?

Thanks
Rashmi

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