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.
 - 
  
    
      #raw_response  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute raw_response.
 - 
  
    
      #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.
      24 25 26  | 
    
      # File 'lib/elasticsearch/model/response/base.rb', line 24 def klass @klass end  | 
  
#raw_response ⇒ Object (readonly)
Returns the value of attribute raw_response.
      24 25 26  | 
    
      # File 'lib/elasticsearch/model/response/base.rb', line 24 def raw_response @raw_response end  | 
  
#response ⇒ Object (readonly)
Returns the value of attribute response.
      24 25 26  | 
    
      # File 'lib/elasticsearch/model/response/base.rb', line 24 def response @response end  | 
  
Instance Method Details
#initialize(klass, response, options = {}) ⇒ Object
      30 31 32 33 34  | 
    
      # File 'lib/elasticsearch/model/response/base.rb', line 30 def initialize(klass, response, ={}) @klass = klass @raw_response = response @response = response end  | 
  
#max_score ⇒ Object
Returns the max_score
      60 61 62  | 
    
      # File 'lib/elasticsearch/model/response/base.rb', line 60 def max_score response.response['hits']['max_score'] end  | 
  
#records ⇒ Object
  This method is abstract.
  
  Implement this method in specific class
      44 45 46  | 
    
      # File 'lib/elasticsearch/model/response/base.rb', line 44 def records raise NotImplemented, "Implement this method in #{klass}" end  | 
  
#results ⇒ Object
  This method is abstract.
  
  Implement this method in specific class
      38 39 40  | 
    
      # File 'lib/elasticsearch/model/response/base.rb', line 38 def results raise NotImplemented, "Implement this method in #{klass}" end  | 
  
#total ⇒ Object
Returns the total number of hits
      50 51 52 53 54 55 56  | 
    
      # File 'lib/elasticsearch/model/response/base.rb', line 50 def total if response.response['hits']['total'].respond_to?(:keys) response.response['hits']['total']['value'] else response.response['hits']['total'] end end  |