Aggregation name cannot support regular expression style include exclude – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 6.8-7.7

Briefly, this error occurs when you try to use regular expression style include/exclude in an aggregation that doesn’t support it. Not all Elasticsearch aggregations support regular expressions. To resolve this issue, you can either remove the regular expression from the aggregation or switch to an aggregation type that supports regular expressions, such as terms aggregation. Additionally, ensure that your Elasticsearch version supports regular expressions in aggregations as older versions may not.

This guide will help you check for common problems that cause the log ” Aggregation [” + name + “] cannot support regular expression style include/exclude ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: search, aggregations.

Log Context

Log “Aggregation [” + name + “] cannot support regular expression style include/exclude ” class name is RareTermsAggregatorFactory.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 return execution.create(name; factories; valuesSource; format;
 includeExclude; searchContext; parent; pipelineAggregators; metaData; maxDocCount; precision);
 }  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) {

 

How helpful was this guide?

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?