Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from elasticsearch import Elasticsearch
- from elasticsearch.helpers import scan as escan
- import pandas as pd
- es = Elasticsearch(dpl_server, verify_certs=False)
- body = {
- "size": 1000,
- "query": {
- "match_all": {}
- }
- }
- response = escan(client=es,
- index="index-*,
- query=body, request_timeout=30, size=1000)
- print(response)
- #<generator object scan at 0x000001BF5A25E518>
- for res in response:
- print(res['_source'])
- # { .... }
- # { .... }
- # { .... }
- df = None
- for res in response:
- if (df is None):
- df = pd.DataFrame([res['_source']])
- else:
- df = pd.concat([df, pd.DataFrame([res['_source']])], sort=True)
Add Comment
Please, Sign In to add comment