By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

select alarmId,alarmTitle,eventTime t_alarm where eventTime>=to_date('2022-01-01 10:00:00','yyyy-MM-dd hh24:mi:ss')and eventTime <=to_date('2022-01-01 12:00:00','yyyy-MM-dd hh24:mi:ss')

想根据 eventTime 进行时间范围查询,如上sql 在 elasticsearch-sql中应该怎么写呢 ?查了查文档 wiki 没找到相关具体的说明 。。。

用的 elastic7.9.2

select * from myindex where date_format(created,'yyyy-MM-dd HH:mm:ss','+08:00') >= '2019-02-28 17:00:00'
select * from myindex where created >= '2019-02-28' 

select eventTime,collectTime,alarmTitle from alarm* where date_format(eventTime,'yyyy-MM-dd HH:mm:ss','+00:00') >= '2021-12-16 16:29:00'
and date_format(eventTime,'yyyy-MM-dd HH:mm:ss','+00:00') <= '2021-12-16 00:00:00

使用这种写法,没问题啊