Skip to content

Commit 2c175a8

Browse files
committed
ESQL: Explain confusing query
This links to an explanation about a very confusing query that you can write in ESQL. It've decided to link to github here to because this query is so deeply at the edge that you need to know that you are dealing with hackers now. Closes #134792
1 parent 1aca0a9 commit 2c175a8

File tree

1 file changed

+9
-1
lines changed
  • docs/reference/query-languages/esql/_snippets/commands/layout

1 file changed

+9
-1
lines changed

docs/reference/query-languages/esql/_snippets/commands/layout/stats-by.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ and then grouping - that is not going to be faster.
7575
::::
7676

7777

78-
**Examples**
78+
### Examples
7979

8080
Calculating a statistic and grouping by the values of another column:
8181

@@ -105,6 +105,8 @@ optional as well:
105105
:::
106106

107107
$$$esql-stats-mv-group$$$
108+
#### Multivalued
109+
108110
If the grouping key is multivalued then the input row is in all groups:
109111

110112
:::{include} ../examples/stats.csv-spec/mv-group.md
@@ -147,6 +149,12 @@ letter of their last name:
147149
:::{include} ../examples/stats.csv-spec/docsStatsByExpression.md
148150
:::
149151

152+
Note: This can get confusing if you do something like `| STATS a + SUM(a) BY a`
153+
if `a` is multivalued. If you do that and are having trouble see
154+
[github](https://github.com/elastic/elasticsearch/issues/134792#issuecomment-3361168090).
155+
156+
#### Naming
157+
150158
Specifying the output column name is optional. If not specified, the new column
151159
name is equal to the expression. The following query returns a column named
152160
`AVG(salary)`:

0 commit comments

Comments
 (0)