phillro/node-elasticsearch-client

Request support for optimistic locking

Closed this issue · 2 comments

I might be wrong but I can't see any way to provide a version number when indexing to force the server to reject updates to stale documents.

Not implemented yet. Gladly take a pull request.

On Sat, Jun 8, 2013 at 8:26 PM, Tom notifications@github.com wrote:

I might be wrong but I can't see any way to provide a version number when
indexing to force the server to reject updates to stale documents.


Reply to this email directly or view it on GitHubhttps://github.com//issues/89
.

after digging in a bit more it actually it seems like it is - you can pass { version: n } where n is the current version of your document and if the version is lower than the currently stored item then it will be rejected. you also need to put {versions: true }when searching to get the versions of each document returned