infinilabs / gateway

🚀 A High-performance gateway designed for search scenarios. Good friend of Elasticsearch/Opensearch/Easysearch.
28 stars 3 forks source link

date_range_precision_tuning增加后kinaba请求异常 #25

Closed liaosy21 closed 2 years ago

liaosy21 commented 2 years ago

gateway: 1.6.0_SNAPSHOT es: 7.8.1 kibana: 7.8.1

尝试测试 date_range_precision_tuning,time_precision:6,预设置精度到“秒”,配置之后kibana请求报错了。 去掉改配置后正常。

flow:
  - name: default_flow
    filter:
      - context_regex_replace:
          context: "_ctx.request.uri"
          pattern: "_from=[^&]*&?"
          to: ""
      - date_range_precision_tuning:
          time_precision: 6
      - get_cache:
      - bulk_reshuffle:
          when:
            contains:
              _ctx.request.path: /_bulk
          elasticsearch: prod
          level: node
          fix_null_id: true
      - elasticsearch:
          elasticsearch: prod  #elasticsearch configure reference name
          max_connection_per_node: 1000 #max tcp connection to upstream, default for all nodes
          max_response_size: -1 #default for all nodes
          balancer: weight
          refresh: # refresh upstream nodes list, need to enable this feature to use elasticsearch nodes auto discovery
            enabled: true
            interval: 60s
      - set_cache:
          cache_type: ristretto
          min_response_size: 100
          max_response_size: 1024000
          cache_ttl: 30s
          max_cache_items: 100000
failed to parse date field [2022-08-00T05:59:32.999Z] with format [strict_date_optional_time]: [failed to parse date field [2022-08-00T05:59:32.999Z] with format [strict_date_optional_time]]

抓包结果内容: kibana_http_400.json.zip

Issue reporter:hebo1982

medcl commented 2 years ago

你的原始查询长什么样, 时间参数传的不对哈,8 月没有 0 号

medcl commented 2 years ago

@hebo1982

hebo1982 commented 2 years ago

感觉是 date_range_precision_tuning 截取出问题了。

进入discover默认会打开前15m的查询:

FA76E20A-75B2-4278-B3A9-B72E2B3709DC

抓到的kibana的请求

98ED0E35-44FF-41CA-8E81-57F2486F88C0

POST的 payload

{"params":{"ignoreThrottled":true,"preference":1660563709344,"index":"app_ex_log-*","body":{"version":true,"size":500,"sort":[{"createTime":{"order":"desc","unmapped_type":"boolean"}}],"aggs":{"2":{"date_histogram":{"field":"createTime","fixed_interval":"30s","time_zone":"Asia/Shanghai","min_doc_count":1}}},"stored_fields":["*"],"script_fields":{},"docvalue_fields":[{"field":"createTime","format":"date_time"}],"_source":{"excludes":[]},"query":{"bool":{"must":[],"filter":[{"match_all":{}},{"range":{"createTime":{"gte":"2022-08-15T11:26:51.953Z","lte":"2022-08-15T11:41:51.953Z","format":"strict_date_optional_time"}}}],"should":[],"must_not":[]}},"highlight":{"pre_tags":["@kibana-highlighted-field@"],"post_tags":["@/kibana-highlighted-field@"],"fields":{"*":{}},"fragment_size":2147483647}},"rest_total_hits_as_int":true,"ignore_unavailable":true,"ignore_throttled":true,"timeout":"30000ms"},"serverStrategy":"es"}
medcl commented 2 years ago

嗯, 是一个 bug, 在处理字段的时候, 如果这个字段带 T 就会触发这个问题,已解决.

medcl commented 2 years ago

试试 #705 http://release.infinilabs.com/gateway/snapshot/

hebo1982 commented 2 years ago

试试 #705 http://release.infinilabs.com/gateway/snapshot/

可以了