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

版本: 6.8-7.7

简而言之,当您尝试在不支持正则表达式的聚合中使用正则表达式风格的include/exclude时,会出现此错误。并非所有Elasticsearch聚合都支持正则表达式。要解决此问题,您可以从聚合中移除正则表达式,或者切换到支持正则表达式的聚合类型,例如terms聚合。此外,请确保您的Elasticsearch版本支持聚合中的正则表达式,因为较早的版本可能不支持。

日志上下文 #


日志 “Aggregation [” + name + “] cannot support regular expression style include/exclude” 的类名是 RareTermsAggregatorFactory.java。我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入了解上下文的人参考:

if ((includeExclude != null) && (includeExclude.isRegexBased())) {
    throw new AggregationExecutionException("Aggregation [" + name + "] cannot support regular expression style include/exclude "
    + "settings as they can only be applied to string fields. Use an array of numeric values for include/exclude clauses " +
    "used to filter numeric fields");
}  
 
if (valuesSource instanceof ValuesSource.Numeric) {