How to check a doc field exist while creating scripted field using painless

Did you solve your issue? I just posted a response here that might help you;