Aggregation name must have cardinality 1 but was cardinality – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 7.9-8.9

Before you dig into reading this guide, have you tried asking OpsGPT what this log means? You’ll receive a customized analysis of your log.

Try OpsGPT now for step-by-step guidance and tailored insights into your Elasticsearch operation.

Briefly, this error occurs when an Elasticsearch aggregation operation is attempted with a cardinality (number of unique values) other than 1. This could be due to incorrect configuration or data inconsistency. To resolve this, ensure that the field you’re aggregating has a cardinality of 1. If it’s a multi-valued field, consider using a different field or adjusting your data model. Alternatively, you could use a different type of aggregation that supports higher cardinalities.

For a complete solution to your to your search operation, try for free AutoOps for Elasticsearch & OpenSearch . With AutoOps and Opster’s proactive support, you don’t have to worry about your search operation – we take charge of it. Get improved performance & stability with less hardware.

This guide will help you check for common problems that cause the log ” Aggregation [” + name() + “] must have cardinality 1 but was [” + cardinality + “] ” 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() + “] must have cardinality 1 but was [” + cardinality + “]” class name is GlobalAggregatorFactory.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 + name
 + "]. Global aggregations can only be defined as top level aggregations"
 );
 }
 if (cardinality != CardinalityUpperBound.ONE) {
 throw new AggregationExecutionException("Aggregation [" + name() + "] must have cardinality 1 but was [" + cardinality + "]");
 }
 return new GlobalAggregator(name; factories; context; metadata);
 }
}

 

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?