Skip to content

Instantly share code, notes, and snippets.

@jprante
Created October 28, 2013 15:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jprante/7198497 to your computer and use it in GitHub Desktop.
Save jprante/7198497 to your computer and use it in GitHub Desktop.
Bulk updates do not conflict, ignore doc versioning
curl -XDELETE 'localhost:9200/test'
curl 'localhost:9200/test/_refresh'
curl -XPUT 'localhost:9200/test'
curl -XPOST 'localhost:9200/_bulk' -d '
{ "index" : { "_index" : "test", "_type" : "doc", "_id" : "1" } }
{ "field1" : "value1"}
'
curl 'localhost:9200/test/_refresh'
# no conflict!
curl -XPOST 'localhost:9200/_bulk' -d '
{ "update" : { "_index" : "test", "_type" : "doc", "_id" : "1", "_version" : 1 } }
{ "doc" : { "field2" : "value2" } }
'
curl 'localhost:9200/test/_refresh'
# no conflict!
curl -XPOST 'localhost:9200/_bulk' -d '
{ "update" : { "_index" : "test", "_type" : "doc", "_id" : "1", "_version" : 1 } }
{ "doc" : { "field3" : "value3" } }
'
curl 'localhost:9200/test/_refresh'
curl 'localhost:9200/test/doc/1'
# --> {"field1":"value1","field2":"value2","field3":"value3"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment