Skip to content

Instantly share code, notes, and snippets.

@yujuwon
Created August 8, 2019 06:43
Show Gist options
  • Save yujuwon/9b49dad6f9619611a2400a8f67f7e76a to your computer and use it in GitHub Desktop.
Save yujuwon/9b49dad6f9619611a2400a8f67f7e76a to your computer and use it in GitHub Desktop.
ES_URL="http://127.0.0.1/index-table/type/_search/?scroll=1m"
SCROLL_URL="http://127.0.0.1/_search/scroll"
headers = {'Content-Type': 'application/json; charset=utf-8'}
data = {"size": 100}
res = json.loads(requests.get(ES_URL, data=json.dumps(data), headers=headers).content)
scroll_data = {"scroll":"1m", "scroll_id" : res['_scroll_id']}
while(len(res) > 0):
res = json.loads(requests.get(SCROLL_URL, data=json.dumps(scroll_data), headers=headers).content)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment