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

版本: 6.8-8.9

简而言之,当在 Elasticsearch 的日期数学表达式中使用了不支持的运算符时,就会出现此错误。日期数学仅支持加法(+)和减法(-)运算符。使用任何其他运算符(如乘法(*)或除法(/))都会触发此错误。要解决此问题,请确保在日期数学表达式中仅使用受支持的运算符。如果需要执行更复杂的计算,请考虑在将日期发送到 Elasticsearch 之前在应用程序代码中进行计算。

日志上下文 #

日志 “operator not supported for date math [{}]” 的类名是 JavaDateMathParser.java. 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入背景的人参考:

if (c == '+') {
 sign = 1;
 } else if (c == '-') {
 sign = -1;
 } else {
 throw new ElasticsearchParseException("operator not supported for date math [{}]"; mathString);
 }
 }  if (i >= mathString.length()) {
 throw new ElasticsearchParseException("truncated date math [{}]"; mathString);