Commit 0b161d2a3d169143ecc75b9450150fb48aa63b1e
1 parent
0deda243
Exists in
master
and in
8 other branches
Fixed error with exclude in certain cases for Elasticsearch 7.7
Showing
2 changed files
with
6 additions
and
1 deletions
Show diff stats
CHANGELOG.md
lib/searchkick/query.rb
@@ -574,7 +574,8 @@ module Searchkick | @@ -574,7 +574,8 @@ module Searchkick | ||
574 | 574 | ||
575 | def build_query(query, filters, should, must_not, custom_filters, multiply_filters) | 575 | def build_query(query, filters, should, must_not, custom_filters, multiply_filters) |
576 | if filters.any? || must_not.any? || should.any? | 576 | if filters.any? || must_not.any? || should.any? |
577 | - bool = {must: query} | 577 | + bool = {} |
578 | + bool[:must] = query if query | ||
578 | bool[:filter] = filters if filters.any? # where | 579 | bool[:filter] = filters if filters.any? # where |
579 | bool[:must_not] = must_not if must_not.any? # exclude | 580 | bool[:must_not] = must_not if must_not.any? # exclude |
580 | bool[:should] = should if should.any? # conversions | 581 | bool[:should] = should if should.any? # conversions |