Adding a field, view painless script error

Hello and thanks for advance for the help.

I am trying to create a new variable in elastic, but no matter what I put in the painless script editor, I get painless script invalid. I would try to debug, but I can't seem to open any error descriptor, meaning I can't see any specific error message beyond the "Painless script invalid". Does anyone know how to see the full error message, or can provide any guidance on how to write a valid painless script? Thank you so much.