我在一个较大的索引上运行_reindex
,得到以下错误:
{
"error" : {
"root_cause" : [
{
"type" : "script_exception",
"reason" : "runtime error",
"script_stack" : [
"ctx._source.es_resync_time = ctx._source.es_resync_time / 1000000;\n }\n }\n ",
" ^---- HERE"
],
"script" : " ...",
"lang" : "painless",
"position" : {
"offset" : 1911,
"start" : 1871,
"end" : 1962
}
}
],
"type" : "script_exception",
"reason" : "runtime error",
"script_stack" : [
"ctx._source.es_resync_time = ctx._source.es_resync_time / 1000000;\n }\n }\n ",
" ^---- HERE"
],
"script" : " ...",
"lang" : "painless",
"position" : {
"offset" : 1911,
"start" : 1871,
"end" : 1962
},
"caused_by" : {
"type" : "class_cast_exception",
"reason" : "Cannot apply [/] operation to types [java.lang.String] and [java.lang.Integer]."
}
},
"status" : 400
}
这个错误是合法的,我很乐意改进我的脚本,但我想有更多的上下文。有没有一种方法可以从错误消息中看到有问题的值或它的记录id?有没有一个try/catch方法可以在脚本中使用?
2条答案
按热度按时间t9eec4r01#
是的,您可以尝试/捕获语句,然后像这样从源代码中Debug任何值
nle07wnf2#
代码中有一个“class_cast_exception”,当尝试将除法(/)操作应用于字符串和整数时会发生。要修复此问题,您需要在执行除法运算之前确保“es_resync_time”字段为数值类型。