Thanks for your reply. I still couldn't figure it out, because every time there is just an empty bracket in the preview.
I also tried what is suggested here: Getting empty value in script field in Kibana 5.2.1.
Probably there is a bug in the code which we have to figure out.
Thanks a lot anyways!