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.
159 160 161 162 163 164 165 |
# File 'lib/elasticity/search.rb', line 159 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
171 172 173 |
# File 'lib/elasticity/search.rb', line 171 def blank? empty? end |
#each ⇒ Object
185 186 187 188 189 |
# File 'lib/elasticity/search.rb', line 185 def each enumerator.each do |group| group.each { |doc| yield(doc) } end end |
#each_batch ⇒ Object
179 180 181 182 183 |
# File 'lib/elasticity/search.rb', line 179 def each_batch enumerator.each do |group| yield(group) end end |
#empty? ⇒ Boolean
167 168 169 |
# File 'lib/elasticity/search.rb', line 167 def empty? total == 0 end |
#total ⇒ Object
175 176 177 |
# File 'lib/elasticity/search.rb', line 175 def total search["hits"]["total"] end |