Skip to content

Instantly share code, notes, and snippets.

@joafeldmann
Created November 5, 2013 14:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save joafeldmann/7319552 to your computer and use it in GitHub Desktop.
Save joafeldmann/7319552 to your computer and use it in GitHub Desktop.
ES versioning
curl -XPUT 'http://localhost:9200/twitter/tweet/1' -d '{
"user" : "kimchy",
"post_date" : "2009-11-15T14:12:12",
"message" : "trying out Elastic Search"
}'
// {"ok":true,"_index":"twitter","_type":"tweet","_id":"1","_version":1}
curl -XPOST localhost:9200/twitter/tweet/1/_update -d '{
"doc": {
"user": "kimchy2"
}
}'
// {"ok":true,"_index":"twitter","_type":"tweet","_id":"1","_version":2}
curl -XPOST localhost:9200/twitter/tweet/1/_update?version=1 -d '{
"doc": {
"user": "kimchy3"
}
}'
// {"ok":true,"_index":"twitter","_type":"tweet","_id":"1","_version":3}
// But this should have failed due to conflict, right?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment