Skip to content

Commit 3ff010b

Browse files
authored
[8.x] ESQL: Updated RENAME docs with the behaviour of multiple column renames (elastic#126523)
Manual backport of elastic#126462 As docs changed in 9.x, it had to be manually backported to the old asciidoc format.
1 parent cf2e7f8 commit 3ff010b

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

docs/reference/esql/processing-commands/rename.asciidoc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ name, all but the rightmost column with the same new name are dropped.
2626
The `RENAME` processing command renames one or more columns. If a column with
2727
the new name already exists, it will be replaced by the new column.
2828

29+
A `RENAME` with multiple column renames is equivalent to multiple sequential `RENAME` commands.
30+
2931
*Examples*
3032

3133
[source,esql]
@@ -40,3 +42,11 @@ Multiple columns can be renamed with a single `RENAME` command:
4042
----
4143
include::{esql-specs}/docs.csv-spec[tag=renameMultipleColumns]
4244
----
45+
46+
47+
With multiple `RENAME` commands:
48+
49+
[source,esql]
50+
----
51+
include::{esql-specs}/docs.csv-spec[tag=renameMultipleColumnsDifferentCommands]
52+
----

x-pack/plugin/esql/qa/testFixtures/src/main/resources/docs.csv-spec

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,18 @@ FROM employees
112112
fn:keyword | ln:keyword
113113
;
114114

115+
docsRenameMultipleColumnsDifferentCommands
116+
// tag::renameMultipleColumnsDifferentCommands[]
117+
FROM employees
118+
| KEEP first_name, last_name
119+
| RENAME first_name AS fn
120+
| RENAME last_name AS ln
121+
// end::renameMultipleColumnsDifferentCommands[]
122+
| LIMIT 0;
123+
124+
fn:keyword | ln:keyword
125+
;
126+
115127
docsSort
116128
// tag::sort[]
117129
FROM employees

0 commit comments

Comments
 (0)