elasticsearch/docs/reference/esql/processing-commands/rename.asciidoc
Alexander Spies da5392134f
ESQL: Validate unique plan attribute names (#110488)
* Enforce an invariant in our dependency checker so that logical plans never have duplicate output attribute names or ids.
* Fix ROW to not produce columns with duplicate names.
* Fix ResolveUnionTypes to not create multiple synthetic field attributes for the same union type.
* Add tests for commands using the same column name more than once.
* Update docs w.r.t. how commands behave if they are used with duplicate column names.
2024-07-17 11:39:02 +02:00

42 lines
907 B
Text

[discrete]
[[esql-rename]]
=== `RENAME`
The `RENAME` processing command renames one or more columns.
**Syntax**
[source,esql]
----
RENAME old_name1 AS new_name1[, ..., old_nameN AS new_nameN]
----
*Parameters*
`old_nameX`::
The name of a column you want to rename.
`new_nameX`::
The new name of the column. If it conflicts with an existing column name,
the existing column is dropped. If multiple columns are renamed to the same
name, all but the rightmost column with the same new name are dropped.
*Description*
The `RENAME` processing command renames one or more columns. If a column with
the new name already exists, it will be replaced by the new column.
*Examples*
[source,esql]
----
include::{esql-specs}/docs.csv-spec[tag=rename]
----
Multiple columns can be renamed with a single `RENAME` command:
[source,esql]
----
include::{esql-specs}/docs.csv-spec[tag=renameMultipleColumns]
----