版本: 7.1-7.15
简而言之,当脚本中使用的正则表达式过于复杂或庞大时,就会发生此错误,Elasticsearch 会因潜在的性能问题而拒绝执行。要解决此问题,您可以简化正则表达式或将其拆分为更小的部分。或者,考虑使用不同的方法来实现相同的结果,例如使用 Elasticsearch 的内置文本分析功能或创建自定义分析器。
日志上下文 #
日志 “[scripting] Regular expression considered too many characters;” 的类名是 LimitedCharSequence.java. 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人参考:
@Override
public char charAt(int index) {
counter.count++;
if (counter.hitLimit()) {
throw new CircuitBreakingException("[scripting] Regular expression considered too many characters; " + details() +
"; this limit can be changed by changed by the [" + CompilerSettings.REGEX_LIMIT_FACTOR.getKey() + "] setting";
CircuitBreaker.Durability.TRANSIENT);
}
return wrapped.charAt(index);
}





