Class: Elasticsearch::Model::Response::Response
- Inherits:
-
Object
- Object
- Elasticsearch::Model::Response::Response
- Includes:
- Enumerable
- Defined in:
- lib/elasticsearch/model/response.rb
Overview
Encapsulate the response returned from the Elasticsearch client
Implements Enumerable and forwards its methods to the #results object.
Instance Attribute Summary collapse
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#response ⇒ Hash
readonly
Returns the Elasticsearch response.
-
#search ⇒ Object
readonly
Returns the value of attribute search.
-
#shards ⇒ Object
readonly
Returns the statistics on shards.
-
#timed_out ⇒ Object
readonly
Returns whether the response timed out.
-
#took ⇒ Object
readonly
Returns the “took” time.
Instance Method Summary collapse
-
#initialize(klass, search, options = {}) ⇒ Response
constructor
A new instance of Response.
-
#records ⇒ Records
Returns the collection of records from the database.
-
#results ⇒ Results
Returns the collection of “hits” from Elasticsearch.
Constructor Details
#initialize(klass, search, options = {}) ⇒ Response
Returns a new instance of Response.
20 21 22 23 |
# File 'lib/elasticsearch/model/response.rb', line 20 def initialize(klass, search, ={}) @klass = klass @search = search end |
Instance Attribute Details
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
13 14 15 |
# File 'lib/elasticsearch/model/response.rb', line 13 def klass @klass end |
#response ⇒ Hash (readonly)
Returns the Elasticsearch response
29 30 31 |
# File 'lib/elasticsearch/model/response.rb', line 29 def response @response end |
#search ⇒ Object (readonly)
Returns the value of attribute search.
13 14 15 |
# File 'lib/elasticsearch/model/response.rb', line 13 def search @search end |
#shards ⇒ Object (readonly)
Returns the statistics on shards
65 66 67 |
# File 'lib/elasticsearch/model/response.rb', line 65 def shards @shards end |
#timed_out ⇒ Object (readonly)
Returns whether the response timed out
59 60 61 |
# File 'lib/elasticsearch/model/response.rb', line 59 def timed_out @timed_out end |
#took ⇒ Object (readonly)
Returns the “took” time
53 54 55 |
# File 'lib/elasticsearch/model/response.rb', line 53 def took @took end |