Module: Pagy::ElasticsearchRailsExtra
- Defined in:
- lib/pagy/extras/elasticsearch_rails.rb
Overview
Paginate ElasticsearchRails response objects
Defined Under Namespace
Modules: BackendAddOn, ModelExtension, PagyAddOn
Class Method Summary collapse
-
.total_count(response) ⇒ Object
Get the count from different version of ElasticsearchRails.
Class Method Details
.total_count(response) ⇒ Object
Get the count from different version of ElasticsearchRails
13 14 15 16 17 18 19 20 |
# File 'lib/pagy/extras/elasticsearch_rails.rb', line 13 def total_count(response) total = if response.respond_to?(:raw_response) response.raw_response['hits']['total'] else response.response['hits']['total'] end total.is_a?(Hash) ? total['value'] : total end |