Class: ElasticSearch::Api::Hits

Inherits:
Object
  • Object
show all
Includes:
Pagination
Defined in:
lib/elasticsearch/client/hits.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Pagination

#current_page, #next_page, #per_page, #previous_page, #total_pages

Constructor Details

#initialize(response, options = {}) ⇒ Hits

Returns a new instance of Hits.



48
49
50
51
52
53
54
55
56
# File 'lib/elasticsearch/client/hits.rb', line 48

def initialize(response, options={})
  @response = response
  @options = options
  @total_entries = response["hits"]["total"]
  @_shards = response["_shards"]
  @facets = response["facets"]
  @scroll_id = response["_scroll_id"] || response["_scrollId"]
  populate(@options[:ids_only])
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



67
68
69
# File 'lib/elasticsearch/client/hits.rb', line 67

def method_missing(method, *args, &block)
  @hits.send(method, *args, &block)
end

Instance Attribute Details

#_shardsObject (readonly)

Returns the value of attribute _shards.



46
47
48
# File 'lib/elasticsearch/client/hits.rb', line 46

def _shards
  @_shards
end

#facetsObject (readonly)

Returns the value of attribute facets.



46
47
48
# File 'lib/elasticsearch/client/hits.rb', line 46

def facets
  @facets
end

#hitsObject (readonly)

Returns the value of attribute hits.



46
47
48
# File 'lib/elasticsearch/client/hits.rb', line 46

def hits
  @hits
end

#responseObject (readonly)

Returns the value of attribute response.



46
47
48
# File 'lib/elasticsearch/client/hits.rb', line 46

def response
  @response
end

#scroll_idObject (readonly)

Returns the value of attribute scroll_id.



46
47
48
# File 'lib/elasticsearch/client/hits.rb', line 46

def scroll_id
  @scroll_id
end

#total_entriesObject (readonly)

Returns the value of attribute total_entries.



46
47
48
# File 'lib/elasticsearch/client/hits.rb', line 46

def total_entries
  @total_entries
end

Instance Method Details

#freezeObject



62
63
64
65
# File 'lib/elasticsearch/client/hits.rb', line 62

def freeze
  @hits.freeze
  super
end

#respond_to?(method, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


71
72
73
# File 'lib/elasticsearch/client/hits.rb', line 71

def respond_to?(method, include_private = false)
  super || @hits.respond_to?(method, include_private)
end

#to_aObject



58
59
60
# File 'lib/elasticsearch/client/hits.rb', line 58

def to_a
  @hits
end