Significant terms aggregation cannot be applied to field – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 6.8-7.7

Briefly, this error occurs when the significant_terms aggregation is applied to a field that is not analyzed or is not of the correct data type. Elasticsearch uses this aggregation to find unusual occurrences in your data. To resolve this issue, ensure that the field you’re aggregating is of text data type and is analyzed. If it’s not, you may need to reindex your data with the correct mappings. Alternatively, you can use a different aggregation that is compatible with the field’s data type.

This guide will help you check for common problems that cause the log ” significant_terms aggregation cannot be applied to field [ ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: search, aggregations.

Log Context

Log “significant_terms aggregation cannot be applied to field [” class name is SignificantTermsAggregatorFactory.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 return new SignificantLongTermsAggregator(name; factories; (ValuesSource.Numeric) valuesSource; config.format();
 bucketCountThresholds; searchContext; parent; significanceHeuristic; this; longFilter; pipelineAggregators;
 metaData);
 }  throw new AggregationExecutionException("significant_terms aggregation cannot be applied to field ["
 + config.fieldContext().field() + "]. It can only be applied to numeric or string fields.");
 }  public enum ExecutionMode {

 

 [ratemypost]

Opster
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.