diff --git a/CHANGELOG.md b/CHANGELOG.md index 92e63c9..9eeb5b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## 4.0.2 [unreleased] +## 4.0.2 - Added block form of `scroll` - Added `clear_scroll` method diff --git a/README.md b/README.md index 40b9b45..ef09b81 100644 --- a/README.md +++ b/README.md @@ -1483,22 +1483,22 @@ indices_boost: {Category => 2, Product => 1} Searchkick also supports the [scroll API](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html). Scrolling is not intended for real time user requests, but rather for processing large amounts of data. ```ruby -products = Product.search "*", scroll: "1m" -while products.any? +Product.search("*", scroll: "1m").scroll do |batch| # process batch ... - - products = products.scroll end ``` -You should call `scroll` on each new set of results, not the original result. - -On the master branch, you can also do: +You can also scroll batches manually. ```ruby -Product.search("*", scroll: "1m").scroll do |batch| +products = Product.search "*", scroll: "1m" +while products.any? # process batch ... + + products = products.scroll end + +products.clear_scroll ``` ## Nested Data diff --git a/lib/searchkick/version.rb b/lib/searchkick/version.rb index 6124bb8..0d853ce 100644 --- a/lib/searchkick/version.rb +++ b/lib/searchkick/version.rb @@ -1,3 +1,3 @@ module Searchkick - VERSION = "4.0.1" + VERSION = "4.0.2" end -- libgit2 0.21.0