Skip to content

Commit 9c40f63

Browse files
committed
[MODEL] Handle total hits as an object in search response
1 parent ed9f449 commit 9c40f63

File tree

1 file changed

+5
-1
lines changed
  • elasticsearch-model/lib/elasticsearch/model/response

1 file changed

+5
-1
lines changed

elasticsearch-model/lib/elasticsearch/model/response/base.rb

+5-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@ def records
4848
# Returns the total number of hits
4949
#
5050
def total
51-
response.response['hits']['total']
51+
if response.response['hits']['total'].respond_to?(:keys)
52+
response.response['hits']['total']['value']
53+
else
54+
response.response['hits']['total']
55+
end
5256
end
5357

5458
# Returns the max_score

0 commit comments

Comments
 (0)