Hello,
I have a number field ('response') with values ranging between 0-2. I need to do scripted field which converts these number to string values. 0=Bad, 1=OK, 2=Excellent. How do I do that?
I am trying:
if (doc['response'].value = 0) { return "Bad"; }
if (doc['response'].value = 1) { return "OK"; }
if (doc['resonnse'].value = 2) { return "Excellent"; }
return "";
However this is not working .
I get errors '...."compile error","script_stack":["if (doc .........lang":"painless","caused_by":{"type":"class_cast_exception","reason":"Cannot cast from [int] to [boolean]."}}}]},"status":500}......'_