Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. from elasticsearch import Elasticsearch
  2. es = Elasticsearch("localhost:9200")
  3. es.update(index='test',doc_type='test1',id='1',body={'doc' {'username':'Tom'},'doc_as_upsert':True})
  4.  
  5. POST /website/pageviews/1/_update
  6. {
  7. "script" : "ctx._source.views+=1",
  8. "upsert": {
  9. "views": 1
  10. }
  11. }
  12.  
  13. from elasticsearch import Elasticsearch
  14.  
  15. es = Elasticsearch()
  16.  
  17. es.update(
  18. index="test",
  19. doc_type="test1",
  20. id="1",
  21. body={"script": "ctx._source.tags+=new_tag",
  22. "params": {
  23. "new_tag" : "search"
  24. }
  25. }
  26. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement