Commit 3d39720ebe735150e0d6844a5b035a1e1a24188e
1 parent
0c17f353
Exists in
master
and in
21 other branches
Added facet options for facet stats
Showing
1 changed file
with
8 additions
and
0 deletions
Show diff stats
lib/searchkick/query.rb
... | ... | @@ -226,6 +226,14 @@ module Searchkick |
226 | 226 | field.to_sym => facet_options[:ranges] |
227 | 227 | } |
228 | 228 | } |
229 | + elsif facet_options[:stats] | |
230 | + payload[:facets][field] = { | |
231 | + terms_stats: { | |
232 | + key_field: field, | |
233 | + value_script: 'doc.score', | |
234 | + size: facet_options[:limit] ? facet_options[:limit] + 150 : 100000 | |
235 | + } | |
236 | + } | |
229 | 237 | else |
230 | 238 | payload[:facets][field] = { |
231 | 239 | terms: { | ... | ... |