Elasticsearch really needs a "update if document exists" ability

Prior to 6.x, I believe something like this would work:

{"update":{"_type":"submission","_index":"rs_2018-05","_id":511393606}}
{"script":{"source":"ctx._source.num_comments += params.count","lang":"painless","params":{"count":1}},"upsert":null}

Now this just throws an error. There is really no way to update documents and ignore missing documents without polluting the logs with a bunch of error messages from doing bulk updates.

It would be very helpful to supply some type of "document_missing":"ignore" functionality so that missing documents that are updated by scripts are silently ignored. As of right now, bulk updates still complete successfully when there are missing documents, but there is no way to suppress the missing document errors that get written to the logs.

Thank you!

Hi,
I found some discussion around why error messages from individual bulk updates are needed for the correct mapping of the results. I'm not sure the argument still holds, but I guess part of the reason of doing this is so there is a 1:1 correspondence from bulk responses to requests. I might be missing something, or maybe you have a different use case in mind though.
If you think this is something that changed during the 6.x release line it might be worth opening a Github issue for further inspection whether this is change is intentional.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.