Having problem retrieving the data from ES for the 1st of every month

Please format your code using </> icon as explained in this guide. It will make your post more readable.

Can you reproduce it with a full script as described here:

Will be easier to reproduce and understand.