Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Update API doesn't support both script and doc #2967
In my application I want to update a document by incrementing a counter using
The counter is incremented but the foo key's value isn't updated.
I expected that my document would be merged and that my script would be executed. But it seems that if
This should either be described in the documentation or combinations of doc, script, and upsert should be accepted and applied.
I'm not sure if this should be supported, it can lead to unexpected behaviour (like what executes first). It is not a common use case. I think the best way to handle this is to just add your partial document to the script itself.
Returning a client error makes sense when both
Btw: you can also add your partial document as a parameter to the script. This is a nice optimisation because it allows Elasticsearch to cache the compiled version of the script.