Please format your code using </>
icon as explained in this guide. It will make your post more readable.
Or use markdown style like:
```
CODE
```
I would not define id to null. I'd just keep setting it.
Not sure it's the problem here though.
May be reproduce with a sample script as explained in About the Elasticsearch category