Last active
February 26, 2020 13:15
-
-
Save deveshkharve/8db871d934da94da96d9e5cdd99636dd to your computer and use it in GitHub Desktop.
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
def getData(): | |
query = { | |
"query": { | |
"match_all": {} | |
}, | |
"sort": [ | |
{ | |
"createdAt": { | |
"order": "desc" | |
} | |
}, | |
{ | |
"id": { | |
"order": "desc" | |
} | |
} | |
], | |
"size": 5000 | |
} | |
results = [] | |
esRes = search(query) | |
results = results + parseData(esRes) | |
while len(esRes['hits']['hits']) > 0: | |
resLen = len(esRes['hits']['hits']) | |
query['search_after'] = esRes['hits']['hits'][resLen-1]['sort'] | |
esRes = search(query) | |
results = results + parseData(esRes) | |
return results |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment