Module: Elasticsearch::Model::Response::Base
Overview
Common funtionality for classes in the Elasticsearch::Model::Response module
Instance Attribute Summary collapse
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #initialize(klass, response, options = {}) ⇒ Object
-
#max_score ⇒ Object
Returns the max_score.
- #records ⇒ Object abstract
- #results ⇒ Object abstract
-
#total ⇒ Object
Returns the total number of hits.
Instance Attribute Details
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
7 8 9 |
# File 'lib/elasticsearch/model/response/base.rb', line 7 def klass @klass end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
7 8 9 |
# File 'lib/elasticsearch/model/response/base.rb', line 7 def response @response end |
Instance Method Details
#initialize(klass, response, options = {}) ⇒ Object
13 14 15 16 |
# File 'lib/elasticsearch/model/response/base.rb', line 13 def initialize(klass, response, ={}) @klass = klass @response = response end |
#max_score ⇒ Object
Returns the max_score
38 39 40 |
# File 'lib/elasticsearch/model/response/base.rb', line 38 def max_score response.response['hits']['max_score'] end |
#records ⇒ Object
This method is abstract.
Implement this method in specific class
26 27 28 |
# File 'lib/elasticsearch/model/response/base.rb', line 26 def records raise NotImplemented, "Implement this method in #{klass}" end |
#results ⇒ Object
This method is abstract.
Implement this method in specific class
20 21 22 |
# File 'lib/elasticsearch/model/response/base.rb', line 20 def results raise NotImplemented, "Implement this method in #{klass}" end |
#total ⇒ Object
Returns the total number of hits
32 33 34 |
# File 'lib/elasticsearch/model/response/base.rb', line 32 def total response.response['hits']['total'] end |