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, mapper, size: 100, scroll: "1m") ⇒ ScanCursor
constructor
A new instance of ScanCursor.
- #total ⇒ Object
Constructor Details
#initialize(client, search_definition, mapper, size: 100, scroll: "1m") ⇒ ScanCursor
Returns a new instance of ScanCursor.
162 163 164 165 166 167 168 |
# File 'lib/elasticity/search.rb', line 162 def initialize(client, search_definition, mapper, size: 100, scroll: "1m") @client = client @search_definition = search_definition @mapper = mapper @size = size @scroll = scroll end |
Instance Method Details
#blank? ⇒ Boolean
174 175 176 |
# File 'lib/elasticity/search.rb', line 174 def blank? empty? end |
#each ⇒ Object
188 189 190 191 192 |
# File 'lib/elasticity/search.rb', line 188 def each enumerator.each do |group| group.each { |doc| yield(doc) } end end |
#each_batch ⇒ Object
182 183 184 185 186 |
# File 'lib/elasticity/search.rb', line 182 def each_batch enumerator.each do |group| yield(group) end end |
#empty? ⇒ Boolean
170 171 172 |
# File 'lib/elasticity/search.rb', line 170 def empty? total == 0 end |
#total ⇒ Object
178 179 180 |
# File 'lib/elasticity/search.rb', line 178 def total search["hits"]["total"] end |