📣 极限科技诚招搜索运维工程师(Elasticsearch/Easysearch)- 全职/北京 👉 : 立即申请加入

版本: 6.8-8.9

简而言之,当 Elasticsearch 遇到不是数字、日期或布尔值的脚本值时会发生此错误。这可能是由于脚本中使用了不正确的数据类型。要解决此问题,您应该首先检查脚本并确保使用的值具有正确的数据类型。如果不是,您应该将它们转换为适当的类型。此外,请确保脚本格式正确且不包含任何语法错误。

日志上下文 #

日志 “Unsupported script value [” + o + " ]; expected a number; date; or boolean" 的类名是 ScriptDoubleValues.java。 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入理解的人参考:

// that scripts return the same internal representation as regular fields; so boolean
// values in scripts need to be converted to a number; and the value formatter will
// make sure of using true/false in the key_as_string field
return ((Boolean) o).booleanValue() ? 1.0 : 0.0;
} else {
    throw new AggregationExecutionException("Unsupported script value [" + o + " ]; expected a number; date; or boolean");
}
}  @Override
public void setScorer(Scorable scorer) {