From 0dd5e6e9b09ae6cdc083a31434184c50fe9447d3 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Tue, 19 Nov 2019 21:58:52 -0800 Subject: [PATCH] Added section on deep pagination - #1341 --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+), 0 deletions(-) diff --git a/README.md b/README.md index c762377..4bd096d 100644 --- a/README.md +++ b/README.md @@ -137,6 +137,8 @@ Limit / offset limit: 20, offset: 40 ``` +**Note:** By default, Elasticsearch [limits pagination](#deep-pagination) to the first 10,000 results for performance + Select ```ruby @@ -1516,6 +1518,22 @@ end products.clear_scroll ``` +## Deep Pagination + +By default, Elasticsearch limits pagination to the first 10,000 results [for performance](https://www.elastic.co/guide/en/elasticsearch/guide/current/pagination.html). We don’t recommend changing this, but if you need to, you can use: + +```ruby +class Product < ApplicationRecord + searchkick settings: {index: {max_result_window: 1000000000}} +end +``` + +And search with: + +```ruby +Product.search("pears", limit: 1000000000, body_options: {track_total_hits: true}) +``` + ## Nested Data To query nested data, use dot notation. -- libgit2 0.21.0