-
-
Save cknoxrun/09673446937c2b945c1d4b9eedf605eb 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
client = Elasticsearch::Client.new(log: false, host: SMPDB_ES_URL) | |
hits = [] | |
search = client.search(index: SMPDB_INDEX, scroll: '5m', body: json) | |
hits.concat(search['hits']['hits'].map { |hit| SmpdbPathway.new(Hashie::Mash.new(hit['_source'])) }) | |
# Call the `scroll` API until empty results are returned | |
while search = client.scroll(scroll_id: search['_scroll_id'], scroll: '5m') and not search['hits']['hits'].blank? do | |
hits.concat(search['hits']['hits'].map { |hit| SmpdbPathway.new(Hashie::Mash.new(hit['_source'])) }) | |
end | |
return hits |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment