#

In 

# :elasticsearch_rails


:elasticsearch_rails is a paginator for ElasticsearchRails response objects.

Model
extend Pagy::Search
Controller
# Get the search in one of the following ways
search = Article.pagy_search(params[:q])
search = Article.pagy_search(params[:q]).records
search = Article.pagy_search(params[:q]).results
# Paginate it
@pagy, @response = pagy(:elasticsearch_rails, search, **options)
Controller
# Standard response (already paginated)
@response = Article.search('*', from: 0, size: 10, ...)
# Get the pagy object out of it
@pagy = pagy(:elasticsearch_rails, @response, **options)
  • search_method: :my_search
    • Customize the name of the search method (default :search)

See also Offset Options

See Offset Readers