PIVOT currently supports only one aggregation found – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 7.5-7.15

Briefly, this error occurs when more than one aggregation is used in a PIVOT query in Elasticsearch. PIVOT queries currently support only one aggregation. To resolve this issue, you can either split your query into multiple queries each with a single aggregation, or you can use a different type of query that supports multiple aggregations. Alternatively, you can restructure your data or your query to achieve the desired result with a single aggregation.

This guide will help you check for common problems that cause the log ” PIVOT currently supports only one aggregation; found [{}] ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: plugin, parser.

Log Context

Log “PIVOT currently supports only one aggregation; found [{}]” class name is LogicalPlanBuilder.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 if (ctx.pivotClause() != null) {
 PivotClauseContext pivotClause = ctx.pivotClause();
 UnresolvedAttribute column = new UnresolvedAttribute(source(pivotClause.column); visitQualifiedName(pivotClause.column));
 List values = namedValues(pivotClause.aggs);
 if (values.size() > 1) {
 throw new ParsingException(source(pivotClause.aggs); "PIVOT currently supports only one aggregation; found [{}]";
 plan = new Pivot(source(pivotClause); plan; column; namedValues(pivotClause.vals); namedValues(pivotClause.aggs));
 return plan;


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?