Skip to content

Commit 9a09004

Browse files
committed
SQL: [Docs] Add limitation for aggregate functions on scalars (elastic#38186)
Currently aggregate functions can operate only directly on fields. They cannot be used on top of scalar functions as painless scripting is currently not supported.
1 parent e6a238f commit 9a09004

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

docs/reference/sql/limitations.asciidoc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ When doing aggregations (`GROUP BY`) {es-sql} relies on {es}'s `composite` aggre
7070
But this type of aggregation does come with a limitation: sorting can only be applied on the key used for the aggregation's buckets. This
7171
means that queries like `SELECT * FROM test GROUP BY age ORDER BY COUNT(*)` are not possible.
7272

73+
[float]
74+
=== Using aggregation functions on top of scalar functions
75+
76+
Aggregation functions like <<sql-functions-aggs-min,`MIN`>>, <<sql-functions-aggs-max,`MAX`>>, etc. can only be used
77+
directly on fields, and so queries like `SELECT MAX(abs(age)) FROM test` are not possible.
78+
7379
[float]
7480
=== Using a sub-select
7581

@@ -90,3 +96,4 @@ include-tagged::{sql-specs}/docs.csv-spec[limitationSubSelectRewritten]
9096

9197
But, if the sub-select would include a `GROUP BY` or `HAVING` or the enclosing `SELECT` would be more complex than `SELECT X
9298
FROM (SELECT ...) WHERE [simple_condition]`, this is currently **un-supported**.
99+

0 commit comments

Comments
 (0)