如何对is_top=1的数据进行pub_time降序,对is_top=0的数据进行update_time降序,并且对所有数据进行is_top降序排序?
is_top = [0, 0, 0, 1, 1, 1, 1]
update_time = [2, 3, 4, 6, 3, 7, 8]
pub_time= [6, 3, 7, 8, 2, 3, 4]
或者说把这段SQL怎么转换成ES的DSL?
SELECT * from table_a a where a.pub_time BETWEEN (now()-interval 90 day) and now()
order by is_top desc,case when is_top = 1 then update_time else pub_time end desc
is_top = [0, 0, 0, 1, 1, 1, 1]
update_time = [2, 3, 4, 6, 3, 7, 8]
pub_time= [6, 3, 7, 8, 2, 3, 4]
或者说把这段SQL怎么转换成ES的DSL?
SELECT * from table_a a where a.pub_time BETWEEN (now()-interval 90 day) and now()
order by is_top desc,case when is_top = 1 then update_time else pub_time end desc
3 个回复
tongchuan1992 - 学无止境、学以致用
赞同来自:
Hao_Lee
赞同来自:
HelloClyde
赞同来自: