Commit b68ea4aa9006b41b40e8296183e826ebc3514d80
1 parent
d4b82eb9
Exists in
master
and in
21 other branches
Only need id and type when load = true
Showing
1 changed file
with
4 additions
and
0 deletions
Show diff stats
lib/searchkick/search.rb
... | ... | @@ -182,6 +182,10 @@ module Searchkick |
182 | 182 | |
183 | 183 | payload = s.to_hash |
184 | 184 | |
185 | + # An empty array will cause only the _id and _type for each hit to be returned | |
186 | + # http://www.elasticsearch.org/guide/reference/api/search/fields/ | |
187 | + payload[:fields] = [] if load | |
188 | + | |
185 | 189 | # suggestions |
186 | 190 | if options[:suggest] |
187 | 191 | suggest_fields = (@searchkick_options[:suggest] || []).map(&:to_s) | ... | ... |