SHARE
TWEET

Untitled

a guest Jul 17th, 2017 45 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. curl -XPOST 'localhost:9200/_bulk?pretty' -H 'Content-Type: application/json' -d '
  2. { "index" : { "_index" : "test", "_type" : "type1", "_id" : "1" } }
  3. { "field1" : "value1" }
  4. { "delete" : { "_index" : "test", "_type" : "type1", "_id" : "2" } }
  5. { "create" : { "_index" : "test", "_type" : "type1", "_id" : "3" } }
  6. { "field1" : "value3" }
  7. { "update" : {"_id" : "1", "_type" : "type1", "_index" : "test"} }
  8. { "doc" : {"field2" : "value2"} }
  9. '
  10.    
  11. import requests
  12. import json
  13.  
  14. data = json.dumps({"field":"value"})
  15.  
  16. r = requests.post("localhost:9200/_bulk?pretty", data=data)
RAW Paste Data
Top