Skip to content

Instantly share code, notes, and snippets.

@Linusp
Created January 20, 2019 14:28
Show Gist options
  • Save Linusp/09bf5b4df9040d84eded271c36c2c1e9 to your computer and use it in GitHub Desktop.
Save Linusp/09bf5b4df9040d84eded271c36c2c1e9 to your computer and use it in GitHub Desktop.
from elasticsearch import Elasticsearch
from elasticsearch.helpers import scan
index = 'some-index'
doctype = 'some-doctype'
client = Elasticsearch(hosts=['localhost:9200'])
for item in scan(client, index=index, doc_type=doctype, preserve_order=True):
print(item['_source'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment