[why] Some queries need to limit the range of fields.
Signed-off-by: Zhang Yuhang zhangyuhang25@huawei.com --- lib/es_query.rb | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/lib/es_query.rb b/lib/es_query.rb index aaaadc2..3cf9852 100644 --- a/lib/es_query.rb +++ b/lib/es_query.rb @@ -42,6 +42,8 @@ def build_mutli_field_subquery_body(items) if value.is_a?(Array) inner_query = build_multi_field_or_query_body(key, value) query_fields.push({ bool: { should: inner_query } }) + elsif key.to_s == 'range' + query_fields.push({ range: value }) else query_fields.push({ term: { key => value } }) end