Skip to content

Commit

Permalink
Merge pull request #85 from dbmi-pitt/maxsibilla/get_uuids_from_es
Browse files Browse the repository at this point in the history
Maxsibilla/get uuids from es
  • Loading branch information
maxsibilla authored Oct 21, 2024
2 parents 4151a86 + 6ae2a3a commit 5240e7b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.37
1.0.38
12 changes: 9 additions & 3 deletions src/opensearch_helper_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ def get_uuids_from_es(index, es_url):
size = 10_000
query = {
"size": size,
"from": len(uuids),
"_source": ["_id"],
"track_total_hits": True,
"query": {
"bool": {
"must": [],
Expand All @@ -58,7 +58,12 @@ def get_uuids_from_es(index, es_url):
"should": [],
"must_not": []
}
}
},
"sort": [
{
"_id": "asc"
}
],
}

end_of_list = False
Expand All @@ -81,7 +86,8 @@ def get_uuids_from_es(index, es_url):
if total <= len(uuids):
end_of_list = True
else:
query['from'] = len(uuids)
# Append 'search_after' to the query with the "sort" value from the last item from the original query's response
query['search_after'] = ret_obj['hits'].get('hits')[len(ret_obj['hits'].get('hits'))-1]['sort']

return uuids

Expand Down

0 comments on commit 5240e7b

Please sign in to comment.