On Mon, Oct 26, 2020 at 03:49:05PM +0800, Zhang Yuhang wrote:
[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 })
we'd better create a new input param to pass range value, if user using: es-find start_time=xxx1,xxx2 current logic : "terms": {"start_time": ["xxx1","xxx2"]} if using: es-find suite=iperf -r/--range start_time=xxx1,xxx2 the logic: range: { "start_time" :{ "gte": "xxx1" "gle": "xxx2" } }
and we should also give an example in comments
Thanks, Weitao
else query_fields.push({ term: { key => value } }) end
-- 2.23.0