class ElasticSearch::Api::Hits

Attributes

_shards[R]
facets[R]
hits[R]
response[R]
scroll_id[R]
total_count[R]
total_entries[R]

Public Class Methods

new(response, options={}) click to toggle source
# File lib/elasticsearch/client/hits.rb, line 59
def initialize(response, options={})
  @response = response
  @options = options
  @total_entries = response["hits"]["total"]
  @_shards = response["_shards"]
  @facets = response["facets"]
  @scroll_id = response["_scroll_id"] || response["_scrollId"]
  populate(@options[:ids_only])
end

Public Instance Methods

freeze() click to toggle source
Calls superclass method
# File lib/elasticsearch/client/hits.rb, line 73
def freeze
  @hits.freeze
  super
end
method_missing(method, *args, &block) click to toggle source
# File lib/elasticsearch/client/hits.rb, line 78
def method_missing(method, *args, &block)
  @hits.send(method, *args, &block)
end
respond_to?(method, include_private = false) click to toggle source
Calls superclass method
# File lib/elasticsearch/client/hits.rb, line 82
def respond_to?(method, include_private = false)
  super || @hits.respond_to?(method, include_private)
end
to_a() click to toggle source
# File lib/elasticsearch/client/hits.rb, line 69
def to_a
  @hits
end

Private Instance Methods

populate(ids_only=false) click to toggle source
# File lib/elasticsearch/client/hits.rb, line 88
def populate(ids_only=false)
  @hits = @response["hits"]["hits"].collect { |h| ids_only ? h["_id"] : Hit.new(h) }
end