日志查询->索引 业务日期字段 目前只能选择时间戳字段嘛?

Viewed 52

image.png

比如我这个索引中有两个时间字段一个是 dtTime 十三位的时间戳, 另一个是 dateTime 2023-05-18 09:17:59.063
选择日期字段时只有时间戳"dtTime"可选, 查询出来的结果, 柱状图没有对应的时间数据

当前ES版本 6.8.0, 夜莺版本 6.0.0-ga.7

2 Answers

可以贴下请求的 payload 和 response

请求

{"search_type":"query_then_fetch","ignore_unavailable":true,"index":"plume_log_run_20230526*"}
{"size":500,"query":{"bool":{"filter":[{"range":{"dtTime":{"gte":1685086742682,"lte":1685086862682,"format":"epoch_millis"}}}]}},"sort":[{"dtTime":{"order":"desc","unmapped_type":"boolean"}}],"script_fields":{},"aggs":{}}

响应

{"took":78,"responses":[{"took":78,"timed_out":false,"_shards":{"total":120,"successful":120,"skipped":115,"failed":0},"hits":{"total":{"value":10000,"relation":"gte"},"max_score":null,"hits":[{"_index":"plume_log_run_2023052615","_type":"_doc","_id":"-D8BV4gB_v3Fc5h3KSQv","_score":null,"_source":{"dateTime":"2023-05-26 15:39:26.667","method":"wrap(R.java:131)","appName":"xiahui-wms-biz","serverName":"172.18.32.73","className":"com.xiahui.common.base.resp.R","env":"local","content":"统一返回:code=0,i18nCode=commons.act.success","threadName":"XNIO-1 task-1","dtTime":"1685086766667","logLevel":"INFO","seq":"294"},"sort":[1685086766667]},"sort":[1685086756729]}]},"status":200}]}