Read again
Could you provide a full recreation script as described in About the Elasticsearch category. It will help to better understand what you are doing. Please, try to keep the example as simple as possible.
I'm highlighting the important part here:
A typical script like this one can be copied and pasted in Kibana Dev Console by any reader.
Here we can't just copy, paste and play and it would require some significant work for a reader to reproduce your case.