Class: ElasticSearch::Api::Hits
- Inherits:
-
Object
- Object
- ElasticSearch::Api::Hits
- Includes:
- Pagination
- Defined in:
- lib/elasticsearch/client/hits.rb
Instance Attribute Summary collapse
-
#_shards ⇒ Object
readonly
Returns the value of attribute _shards.
-
#facets ⇒ Object
readonly
Returns the value of attribute facets.
-
#hits ⇒ Object
readonly
Returns the value of attribute hits.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#scroll_id ⇒ Object
readonly
Returns the value of attribute scroll_id.
-
#total_entries ⇒ Object
(also: #total_count)
readonly
Returns the value of attribute total_entries.
Instance Method Summary collapse
- #freeze ⇒ Object
-
#initialize(response, options = {}) ⇒ Hits
constructor
A new instance of Hits.
- #method_missing(method, *args, &block) ⇒ Object
- #respond_to?(method, include_private = false) ⇒ Boolean
- #to_a ⇒ Object
Methods included from Pagination
#current_page, #next_page, #offset, #per_page, #previous_page, #total_pages
Constructor Details
#initialize(response, options = {}) ⇒ Hits
Returns a new instance of Hits.
59 60 61 62 63 64 65 66 67 |
# File 'lib/elasticsearch/client/hits.rb', line 59 def initialize(response, ={}) @response = response @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
78 79 80 |
# File 'lib/elasticsearch/client/hits.rb', line 78 def method_missing(method, *args, &block) @hits.send(method, *args, &block) end |
Instance Attribute Details
#_shards ⇒ Object (readonly)
Returns the value of attribute _shards.
56 57 58 |
# File 'lib/elasticsearch/client/hits.rb', line 56 def _shards @_shards end |
#facets ⇒ Object (readonly)
Returns the value of attribute facets.
56 57 58 |
# File 'lib/elasticsearch/client/hits.rb', line 56 def facets @facets end |
#hits ⇒ Object (readonly)
Returns the value of attribute hits.
56 57 58 |
# File 'lib/elasticsearch/client/hits.rb', line 56 def hits @hits end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
56 57 58 |
# File 'lib/elasticsearch/client/hits.rb', line 56 def response @response end |
#scroll_id ⇒ Object (readonly)
Returns the value of attribute scroll_id.
56 57 58 |
# File 'lib/elasticsearch/client/hits.rb', line 56 def scroll_id @scroll_id end |
#total_entries ⇒ Object (readonly) Also known as: total_count
Returns the value of attribute total_entries.
56 57 58 |
# File 'lib/elasticsearch/client/hits.rb', line 56 def total_entries @total_entries end |
Instance Method Details
#freeze ⇒ Object
73 74 75 76 |
# File 'lib/elasticsearch/client/hits.rb', line 73 def freeze @hits.freeze super end |
#respond_to?(method, include_private = false) ⇒ Boolean
82 83 84 |
# File 'lib/elasticsearch/client/hits.rb', line 82 def respond_to?(method, include_private = false) super || @hits.respond_to?(method, include_private) end |
#to_a ⇒ Object
69 70 71 |
# File 'lib/elasticsearch/client/hits.rb', line 69 def to_a @hits end |