| « PreviousNext » | |
![]() ![]() ![]() | Did this page help you? Yes | No | Tell us about it... |
In some cases, you might have multiple processes submitting batches of documents to your domain. Because it's possible that these batches could contain changes to the same document, and that the batches might be received out of order, Amazon CloudSearch always applies the add or delete operation that has the highest version number. If the version number specified for a document is lower than in a previously-received operation, the change is ignored. If the version number specified for a document is the same as in a previously-received operation, the results are undefined. There's no way to predict which operation will take precedence.
Important
To update or delete an existing document, you must specify a new, larger version number. You do not specify the version that you want to update or delete.
To successfully update and delete documents, you have to keep track of the version numbers. One common approach is to use timestamps for versioning. Keep in mind that the version is stored as a 32-bit unsigned integer. If you're versioning with timestamps, you have to strip off the milliseconds or the timestamp will overflow. If you want to be able to query the index for your documents' version numbers, create a version field and populate it with the current version each time you update a document.
When deleting documents, note that deleting version max(uint32_t) will permanently remove the document from your domain. Because it is not possible to specify a higher version number, there is no way to add a later version of the document.