Method: Elastictastic::BasicDocument::ClassMethods#find_in_batches

Defined in:
lib/elastictastic/basic_document.rb

#find_in_batches(batch_options = {}) {|batch| ... } ⇒ Enumerator

Retrieve all documents in the default index, yielding them in batches.

Parameters:

  • batch_options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (batch_options):

  • :batch_size (Fixnum) — default: Elastictastic.config.default_batch_size

    How many documents to retrieve from the server in each batch.

  • :ttl (Fixnum) — default: 60

    How long to keep the cursor alive, in the case where search is performed with a cursor.

Yields:

  • (batch)

    Once for each batch of hits

Yield Parameters:

  • batch (Enumerator)

    An enumerator for this batch of hits. The enumerator will yield a materialized Document and a Hashie::Mash wrapping each raw hit.

Returns:

  • (Enumerator)

    An enumerator that yields batches, if no block is passed.



# File 'lib/elastictastic/basic_document.rb', line 74