2023年11月29日发(作者:)
Elasticsearchpainless脚本中空值的检查
最近在做脚本重评分时,遇上了⼀个空值问题。查询时painless脚本中若遇到字段中的值为空值就会报错,本来想⽤ value == null 这种形式的判断来判断字段值是否为空,然后
过来掉,结果发现并不⾏,
以下时错误⽰范:
这个重评分的代码在defprice字段全部都有值得时候运⾏正常,但是⼀旦出现没有值得情况,就会报以下错误
{
"error": {
"root_cause": [{
"type": "script_exception",
"reason": "runtime error",
"script_stack": [
"DocValues$(:121)",
"DocValues$ue(:115)",
"if(doc['cpinfo_ce'].value>0) {",


发布评论