module Elasticsearch::Model::Response::Base
Common funtionality for classes in the {Elasticsearch::Model::Response} module
Attributes
klass[R]
response[R]
Public Class Methods
new(klass, response, options={})
click to toggle source
@param klass [Class] The name of the model class @param response [Hash] The full response returned from Elasticsearch
client @param options [Hash] Optional parameters
# File lib/elasticsearch/model/response/base.rb, line 13 def initialize(klass, response, options={}) @klass = klass @response = response end
Public Instance Methods
max_score()
click to toggle source
Returns the max_score
# File lib/elasticsearch/model/response/base.rb, line 38 def max_score response.response['hits']['max_score'] end
records()
click to toggle source
@abstract Implement this method in specific class
# File lib/elasticsearch/model/response/base.rb, line 26 def records raise NotImplemented, "Implement this method in #{klass}" end
results()
click to toggle source
@abstract Implement this method in specific class
# File lib/elasticsearch/model/response/base.rb, line 20 def results raise NotImplemented, "Implement this method in #{klass}" end
total()
click to toggle source
Returns the total number of hits
# File lib/elasticsearch/model/response/base.rb, line 32 def total response.response['hits']['total'] end