Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ pip install elasticsearch
- from elasticsearch import Elasticsearch
- es = Elasticsearch(['http://127.0.0.1:9200'])
- res = es.search(index="test-index", body={"query": {"match_all": {}}})
- print("Got %d Hits:" % res['hits']['total'])
- for hit in res['hits']['hits']:
- print("%(timestamp)s %(author)s: %(text)s" % hit["_source"])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement