Method: Elastictastic::BasicDocument::ClassMethods#find_each

Defined in:
lib/elastictastic/basic_document.rb

#find_each(batch_options = {}) {|document, hit| ... } ⇒ Enumerator

Iterate over all documents in the default index, retrieving documents in batches using a cursor, but yielding them one by one.

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:

  • (document, hit)

    Each result is yielded to the block

Yield Parameters:

  • document (Document)

    A materialized Document instance

  • hit (Hashie::Mash)

    The raw hit from ElasticSearch, wrapped in a Hashie::Mash. Useful for extracting metadata, e.g. highlighting



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