elasticsearch-rails
https://github.com/elastic/elasticsearch-rails
Ruby
Elasticsearch integrations for ActiveModel/Record and Ruby on Rails
Elasticsearch::Persistence::Model::Find::ClassMethods#find_in_batches
Returns all models efficiently via the Elasticsearch's scan/scroll API
You can restrict the models being returned with a query.
The {http://rubydoc.info/gems/elasticsearch-api/Elasticsearch/API/Actions#search-instance_method Search API}
options are passed to the search method as parameters, all remaining options are passed
as the `:body` parameter.
The full {Persistence::Repository::Response::Results} instance is yielded to the passed
block in each batch, so you can access any of its properties; calling `to_a` will
convert the object to an Array of model instances.Edit
git clone [email protected]:elastic/elasticsearch-rails.git
cd elasticsearch-rails
open elasticsearch-persistence/lib/elasticsearch/persistence/model/find.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-Elasticsearch--Persistence--Model--Find--ClassMethods-find_in_batches-for-pr
# Commit to gitgit add elasticsearch-persistence/lib/elasticsearch/persistence/model/find.rbgit commit -m "better docs for Elasticsearch::Persistence::Model::Find::ClassMethods#find_in_batches"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-Elasticsearch--Persistence--Model--Find--ClassMethods-find_in_batches-for-pr
hub pull-request
# Celebrate!