Created
February 9, 2015 16:31
-
-
Save ivarvong/68e0306ae65cfe45a5b7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
require 'elasticsearch' | |
url = `heroku config --app <heroku-app-name> | grep "SEARCHBOX_SSL_URL:"`.split(": ").last.strip | |
client = Elasticsearch::Client.new(url: url) | |
# https://github.com/elasticsearch/elasticsearch-ruby/issues/49 | |
scan_response = client.search(index: 'pixels', search_type: 'scan', scroll: '5m', size: 10) | |
while response = client.scroll(scroll_id: scan_response['_scroll_id'], scroll: '5m') and !response['hits']['hits'].empty? do | |
puts response['hits']['hits'].map { |r| r['_source'] } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment