Skip to content

Instantly share code, notes, and snippets.

@dadoonet
Last active December 29, 2015 17:29
Show Gist options
  • Save dadoonet/7704908 to your computer and use it in GitHub Desktop.
Save dadoonet/7704908 to your computer and use it in GitHub Desktop.
Related to issue: https://github.com/elasticsearch/elasticsearch/issues/4300 Version number could appear as inconsistent
curl -XDELETE "http://localhost:9200/myindex"; echo
curl -XPUT "http://localhost:9200/myindex" -d'
{
"settings": {
"gc_deletes": "30s"
}
}'; echo
curl -XPUT "http://localhost:9200/myindex/doc/1" -d'{ "foo" : "bar" }'; echo
curl -XDELETE "http://localhost:9200/myindex/doc/1?version=1"; echo
curl -XPUT "http://localhost:9200/myindex/doc/1?version=2" -d'{ "foo" : "bar" }'; echo
# {"ok":true,"_index":"myindex","_type":"doc","_id":"1","_version":3}
curl -XDELETE "http://localhost:9200/myindex"; echo
curl -XPUT "http://localhost:9200/myindex" -d'
{
"settings": {
"gc_deletes": "1ms"
}
}'; echo
curl -XPUT "http://localhost:9200/myindex/doc/1" -d'{ "foo" : "bar" }'; echo
curl -XDELETE "http://localhost:9200/myindex/doc/1?version=1"; echo
sleep 1
curl -XPUT "http://localhost:9200/myindex/doc/1?version=2" -d'{ "foo" : "bar" }'; echo
# {"error":"VersionConflictEngineException[[myindex][2] [doc][1]: version conflict, current [-1], provided [2]]","status":409}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment