class LogStash::Inputs::Elasticsearch::Scroll

Constants

SCROLL_JOB

Public Instance Methods

clear(scroll_id) click to toggle source
# File lib/logstash/inputs/elasticsearch/paginated_search.rb, line 113
def clear(scroll_id)
  @client.clear_scroll(:body => { :scroll_id => scroll_id }) if scroll_id
rescue => e
  # ignore & log any clear_scroll errors
  logger.debug("Ignoring clear_scroll exception", message: e.message, exception: e.class)
end
next_page(scroll_id) click to toggle source
# File lib/logstash/inputs/elasticsearch/paginated_search.rb, line 67
def next_page(scroll_id)
  @client.scroll(:body => { :scroll_id => scroll_id }, :scroll => @scroll)
end
process_page(output_queue) { || ... } click to toggle source
# File lib/logstash/inputs/elasticsearch/paginated_search.rb, line 71
def process_page(output_queue)
  r = yield
  r['hits']['hits'].each { |hit| @plugin.push_hit(hit, output_queue) }
  [r['hits']['hits'].any?, r['_scroll_id']]
end
search_options(slice_id) click to toggle source
# File lib/logstash/inputs/elasticsearch/paginated_search.rb, line 51
def search_options(slice_id)
  query = @query
  query = @query.merge('slice' => { 'id' => slice_id, 'max' => @slices}) unless slice_id.nil?
  {
    :index => @index,
    :scroll => @scroll,
    :size => @size,
    :body => LogStash::Json.dump(query)
  }
end