Commit 0dd5e6e9b09ae6cdc083a31434184c50fe9447d3

Authored by Andrew Kane
1 parent 70233d72

Added section on deep pagination - #1341

Showing 1 changed file with 18 additions and 0 deletions   Show diff stats
README.md
... ... @@ -137,6 +137,8 @@ Limit / offset
137 137 limit: 20, offset: 40
138 138 ```
139 139  
  140 +**Note:** By default, Elasticsearch [limits pagination](#deep-pagination) to the first 10,000 results for performance
  141 +
140 142 Select
141 143  
142 144 ```ruby
... ... @@ -1516,6 +1518,22 @@ end
1516 1518 products.clear_scroll
1517 1519 ```
1518 1520  
  1521 +## Deep Pagination
  1522 +
  1523 +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:
  1524 +
  1525 +```ruby
  1526 +class Product < ApplicationRecord
  1527 + searchkick settings: {index: {max_result_window: 1000000000}}
  1528 +end
  1529 +```
  1530 +
  1531 +And search with:
  1532 +
  1533 +```ruby
  1534 +Product.search("pears", limit: 1000000000, body_options: {track_total_hits: true})
  1535 +```
  1536 +
1519 1537 ## Nested Data
1520 1538  
1521 1539 To query nested data, use dot notation.
... ...