class Elasticsearch::Rails2::Response::Response

Encapsulate the response returned from the Elasticsearch client

Implements Enumerable and forwards its methods to the {#results} object.

Attributes

klass[R]
response[R]
shards[R]
timed_out[R]
took[R]

Public Class Methods

new(klass, search, options={}) click to toggle source
# File lib/elasticsearch/rails2/response.rb, line 19
def initialize(klass, search, options={})
  @klass     = klass
  @search    = search
end

Public Instance Methods

records() click to toggle source

Returns the collection of records from the database

@return [Records]

# File lib/elasticsearch/rails2/response.rb, line 46
def records
  @records ||= Records.new(klass, self)
end
results() click to toggle source

Returns the collection of “hits” from Elasticsearch

@return [Results]

# File lib/elasticsearch/rails2/response.rb, line 38
def results
  @results ||= Results.new(klass, self)
end
scroll_id() click to toggle source

Returns whether the response scroll id

# File lib/elasticsearch/rails2/response.rb, line 70
def scroll_id
  response['_scroll_id']
end