You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The driver converts Scout builders into OpenSearch search requests and uses the configured OpenSearch client connection to index, delete, flush, and search models.
79
79
80
+
### Cursor Pagination
81
+
82
+
For deep pagination, use `cursorPaginate` with an explicit, stable sort:
83
+
84
+
```php
85
+
$posts = Post::search('laravel')
86
+
->orderBy('published_at', 'desc')
87
+
->orderBy('id', 'desc')
88
+
->cursorPaginate(25);
89
+
```
90
+
91
+
Cursor pagination uses OpenSearch `search_after` values internally and returns Laravel's standard `CursorPaginator` response shape, including `next_cursor` and `prev_cursor`.
92
+
93
+
OpenSearch only returns reusable `search_after` values for sorted searches, so cursor pagination requires at least one explicit sort. Prefer adding a unique indexed tie-breaker, such as an indexed model key, as the final sort.
94
+
80
95
## Credits
81
96
82
97
This package builds on a lot of the foundation and prior work from [Ivan Babenko](https://github.com/babenkoivan) and his Elasticsearch Laravel ecosystem packages.
0 commit comments