diff --git a/elasticsearch-model/lib/elasticsearch/model/response/base.rb b/elasticsearch-model/lib/elasticsearch/model/response/base.rb
index <HASH>..<HASH> 100644
--- a/elasticsearch-model/lib/elasticsearch/model/response/base.rb
+++ b/elasticsearch-model/lib/elasticsearch/model/response/base.rb
@@ -48,7 +48,11 @@ module Elasticsearch
         # Returns the total number of hits
         #
         def total
-          response.response['hits']['total']
+          if response.response['hits']['total'].respond_to?(:keys)
+            response.response['hits']['total']['value']
+          else
+            response.response['hits']['total']
+          end
         end
 
         # Returns the max_score
[MODEL] Handle total hits as an object in search response