Created
January 8, 2019 10:22
-
-
Save nailo2c/daf740e1b82acf1000c716d34f1c89d6 to your computer and use it in GitHub Desktop.
Use ElasticSearch python api to retrieve all data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from elasticsearch import Elasticsearch | |
from elasticsearch import helpers | |
es_url = 'https://your/elasticsearch/url/' | |
index = '*your-index*' | |
query = { | |
"query": { | |
"match_all": {} | |
} | |
} | |
es = Elasticsearch( | |
[es_url], | |
use_ssl=True, | |
request_timeout=30) | |
scan = helpers.scan(es, | |
query=query, | |
index=index, | |
preserve_order=True) | |
for item in scan: | |
print('do something') | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment