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.
121 122 123 124 125 126 127 |
# File 'lib/elasticity/search.rb', line 121 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
133 134 135 |
# File 'lib/elasticity/search.rb', line 133 def blank? empty? end |
#each ⇒ Object
147 148 149 150 151 |
# File 'lib/elasticity/search.rb', line 147 def each enumerator.each do |group| group.each { |doc| yield(doc) } end end |
#each_batch ⇒ Object
141 142 143 144 145 |
# File 'lib/elasticity/search.rb', line 141 def each_batch enumerator.each do |group| yield(group) end end |
#empty? ⇒ Boolean
129 130 131 |
# File 'lib/elasticity/search.rb', line 129 def empty? total == 0 end |
#total ⇒ Object
137 138 139 |
# File 'lib/elasticity/search.rb', line 137 def total search["hits"]["total"] end |