Elasticsearch script groovy - Document Fields

I am trying to execute one inline script from my application but whatever I do I am receiving the same error

"failed to run inline script [doc['my_field'].value-1400000000] using lang [groovy]","caused_by":{"type":"illegal_argument_exception","reason":"No field found for [my_field] in mapping with types [t]"

I have set "script.engine.groovy.inline.search: true " in the yml. I checked if the field is not missing for real and tried with any other field. If I try to execute script that is not calling any field the script is working. Am I missing something? What could be the root problem for this?

Thanks