Elastictastic currently implements an ::update method, which allows applications to perform modifications to a document and transparently retry in the case of a version conflict. Implement a ::create_or_update method that attempts to create a document, and then retries with an update in the case of a DocumentAlreadyExists. This would, of course, only be meaningful in the case when IDs are set by the application on creation.
Elastictastic currently implements an
::update
method, which allows applications to perform modifications to a document and transparently retry in the case of a version conflict. Implement a::create_or_update
method that attempts to create a document, and then retries with an update in the case of aDocumentAlreadyExists
. This would, of course, only be meaningful in the case when IDs are set by the application on creation.