Class: Elasticity::Search::ScanCursor
- Inherits:
-
Object
- Object
- Elasticity::Search::ScanCursor
- Includes:
- Enumerable
- Defined in:
- lib/elasticity/search.rb
Instance Method Summary collapse
- #blank? ⇒ Boolean
- #each ⇒ Object
- #each_batch ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(client, search_definition, document_klass, size: 100, scroll: "1m") ⇒ ScanCursor
constructor
A new instance of ScanCursor.
- #total ⇒ Object
Constructor Details
#initialize(client, search_definition, document_klass, size: 100, scroll: "1m") ⇒ ScanCursor
Returns a new instance of ScanCursor.
150 151 152 153 154 155 156 |
# File 'lib/elasticity/search.rb', line 150 def initialize(client, search_definition, document_klass, size: 100, scroll: "1m") @client = client @search_definition = search_definition @document_klass = document_klass @size = size @scroll = scroll end |
Instance Method Details
#blank? ⇒ Boolean
162 163 164 |
# File 'lib/elasticity/search.rb', line 162 def blank? empty? end |
#each ⇒ Object
176 177 178 179 180 |
# File 'lib/elasticity/search.rb', line 176 def each enumerator.each do |group| group.each { |doc| yield(doc) } end end |
#each_batch ⇒ Object
170 171 172 173 174 |
# File 'lib/elasticity/search.rb', line 170 def each_batch enumerator.each do |group| yield(group) end end |
#empty? ⇒ Boolean
158 159 160 |
# File 'lib/elasticity/search.rb', line 158 def empty? total == 0 end |
#total ⇒ Object
166 167 168 |
# File 'lib/elasticity/search.rb', line 166 def total search["hits"]["total"] end |