I meant what is described in the link I provided: About the Elasticsearch category
A typical script like this one can be copied and pasted in Kibana Dev Console by any reader. It will definitely help to play with your example and provide a fix for your script.