On Mon, Oct 26, 2020 at 05:59:28PM +0800, Zhang Yuhang wrote:
On Mon, Oct 26, 2020 at 05:35:25PM +0800, Lu Weitao wrote:
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" } }
May occur. range: { "field_name" :{ "gt": "xxx1" "lt": "xxx2" } }
Maybe we need to create a new todo, such as "add range query in es-find".
yes, should defined how to use es-find
and we should also give an example in comments
Sorry, Would your give me the general content of the comment?
Like this?
# range = { # 'start_time': { # 'gte': '2020-10-01 00:00:00', # 'lte': 'now' # } # } # items['range'] = range # build_mutli_field_subquery_body(items)
yes
Thanks, Weitao
Thanks, Zhang Yuhang
Thanks, Weitao
else query_fields.push({ term: { key => value } }) end
-- 2.23.0