GROUP BY ALL is not supported – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 6.8-8.9

Briefly, this error occurs when you try to use the “GROUP BY ALL” clause in Elasticsearch, which is not supported. Elasticsearch uses aggregations for grouping data, not SQL-like syntax. To resolve this issue, you should use the appropriate Elasticsearch aggregations such as “terms”, “avg”, “sum”, “min”, “max”, etc. to group your data. You can also use the “composite” aggregation for complex grouping. Make sure to understand the structure of your data and the type of analysis you want to perform to choose the right aggregation.

This guide will help you check for common problems that cause the log ” GROUP BY ALL is not supported ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: parser, plugin.

Log Context

Log “GROUP BY ALL is not supported” class name is LogicalPlanBuilder.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 GroupByContext groupByCtx = ctx.groupBy();
 if (groupByCtx != null) {
 SetQuantifierContext setQualifierContext = groupByCtx.setQuantifier();
 TerminalNode groupByAll = setQualifierContext == null ? null : setQualifierContext.ALL();
 if (groupByAll != null) {
 throw new ParsingException(source(groupByAll); "GROUP BY ALL is not supported");
 }
 List groupingElement = groupByCtx.groupingElement();
 List groupBy = expressions(groupingElement);
 ParserRuleContext endSource = groupingElement.isEmpty() ? groupByCtx : groupingElement.get(groupingElement.size() - 1);
 query = new Aggregate(source(ctx.GROUP(); endSource); query; groupBy; selectTarget);

 

 [ratemypost]