Class: Elasticsearch::Model::Response::Results

Inherits:
Object
  • Object
show all
Includes:
Base, Enumerable
Defined in:
lib/elasticsearch/model/response/results.rb

Overview

Encapsulates the collection of documents returned from Elasticsearch

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

Instance Attribute Summary

Attributes included from Base

#klass, #raw_response, #response

Instance Method Summary collapse

Methods included from Base

#max_score, #records, #total

Constructor Details

#initialize(klass, response, options = {}) ⇒ Results

Returns a new instance of Results.

See Also:


34
35
36
# File 'lib/elasticsearch/model/response/results.rb', line 34

def initialize(klass, response, options={})
  super
end

Instance Method Details

#resultsObject


40
41
42
43
# File 'lib/elasticsearch/model/response/results.rb', line 40

def results
  # TODO: Configurable custom wrapper
  response.response['hits']['hits'].map { |hit| Result.new(hit) }
end