Method: Chewy::Search::Scrolling#scroll_objects
- Defined in:
- lib/chewy/search/scrolling.rb
#scroll_objects(batch_size: 1000, scroll: '1m') {|record| ... } ⇒ Object #scroll_objects(batch_size: 1000, scroll: '1m') ⇒ Enumerator Also known as: scroll_records, scroll_documents
Note:
If the record is not found it yields nil instead.
Iterates through the documents of the scope in batches. Performs load operation for each batch and then yields each loaded ORM/ODM object. Uses Request#load passed options for loading.
118 119 120 121 122 123 124 125 |
# File 'lib/chewy/search/scrolling.rb', line 118 def scroll_objects(**, &block) return enum_for(:scroll_objects, **) unless block_given? except(:source, :stored_fields, :script_fields, :docvalue_fields) .source(false).scroll_batches(**).each do |batch| loader.load(batch).each(&block) end end |