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

版本: 7-7.15

简而言之,当您尝试在不支持正则表达式样式的聚合中使用正则表达式样式时,会出现此错误。Elasticsearch 在某些领域支持正则表达式,但并非所有领域都支持。该错误表明您尝试使用的特定聚合不支持您正在使用的正则表达式样式。要解决此问题,您可以更改聚合类型以支持正则表达式,或者修改查询以不使用正则表达式。或者,您可以在聚合之前使用脚本处理正则表达式。

日志上下文 #

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

    subAggCollectMode = pickSubAggColectMode(factories, bucketCountThresholds.getShardSize(), maxOrd); 
}  
 
if ((includeExclude != null) && (includeExclude.isRegexBased()) && valuesSourceConfig.format() != DocValueFormat.RAW) {
    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 values for "
    + "include/exclude clauses");
}