日期范围查询sql怎么写
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'
不行啊 class org.elasticsearch.common.io.stream.NotSerializableExceptionWrapper: class_cast_exception: Cannot apply [<] operation to types [java.lang.String] and [java.lang.String].
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
使用这种写法,没问题啊