嘿~ 今天天气不错嘛

我在rescore中想用script_score对topN结果对不同类型的字段按其值进行排序,怎么判断字段类型

Elasticsearch | 作者 zhuqingrui | 发布于2019年03月28日 | 阅读数:1159

"rescore":{"query":{"query_weight":0,"rescore_query":{"function_score":{"script_score":{"script":" doc['allwords'].value"}}},"rescore_query_weight":1.0,"score_mode":"total"},"window_size":400},"size":1000}
 
数值的:直接取值doc['allwords'].value
时间的:doc.newchaptertime.value.millis
 
==我现在只能在外部按不同的字段判断处理
已邀请:

rochy - rochy_he

赞同来自:

script 里面判断使用 
if(doc['type'].value == ''){}
else if()
else{}

要回复问题请先登录注册