Commit 50f4da2a46f846811df2845ee042d0ab59d490ca

Authored by Andrew Kane
1 parent fe639ff0

track_total_hits only applies to ES 7

Showing 2 changed files with 3 additions and 3 deletions   Show diff stats
@@ -180,7 +180,7 @@ Get the full response from Elasticsearch @@ -180,7 +180,7 @@ Get the full response from Elasticsearch
180 results.response 180 results.response
181 ``` 181 ```
182 182
183 -**Note:** By default, Elasticsearch [limits paging](#deep-paging-master) to the first 10,000 results for performance. This applies to the total count as well. 183 +**Note:** By default, Elasticsearch [limits paging](#deep-paging-master) to the first 10,000 results for performance. With Elasticsearch 7, this applies to the total count as well.
184 184
185 ### Boosting 185 ### Boosting
186 186
@@ -1528,7 +1528,7 @@ class Product < ApplicationRecord @@ -1528,7 +1528,7 @@ class Product < ApplicationRecord
1528 end 1528 end
1529 ``` 1529 ```
1530 1530
1531 -If you just need an accurate total count, you can instead use: 1531 +If you just need an accurate total count with Elasticsearch 7, you can instead use:
1532 1532
1533 ```ruby 1533 ```ruby
1534 Product.search("pears", body_options: {track_total_hits: true}) 1534 Product.search("pears", body_options: {track_total_hits: true})
lib/searchkick/query.rb
@@ -518,7 +518,7 @@ module Searchkick @@ -518,7 +518,7 @@ module Searchkick
518 # routing 518 # routing
519 @routing = options[:routing] if options[:routing] 519 @routing = options[:routing] if options[:routing]
520 520
521 - if searchkick_options[:deep_paging] 521 + if searchkick_options[:deep_paging] && !below70?
522 payload[:track_total_hits] = true 522 payload[:track_total_hits] = true
523 end 523 end
524 524