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
133 134 135 136 137 138 139 |
# File 'lib/elasticity/search.rb', line 133 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
145 146 147 |
# File 'lib/elasticity/search.rb', line 145 def blank? empty? end |
#each ⇒ Object
159 160 161 162 163 |
# File 'lib/elasticity/search.rb', line 159 def each enumerator.each do |group| group.each { |doc| yield(doc) } end end |
#each_batch ⇒ Object
153 154 155 156 157 |
# File 'lib/elasticity/search.rb', line 153 def each_batch enumerator.each do |group| yield(group) end end |
#empty? ⇒ Boolean
141 142 143 |
# File 'lib/elasticity/search.rb', line 141 def empty? total == 0 end |
#total ⇒ Object
149 150 151 |
# File 'lib/elasticity/search.rb', line 149 def total search["hits"]["total"] end |