rename command - Amazon OpenSearch Service

rename command

Use the rename command to change the names of one or more fields in the search result.

Note

To see which AWS data source integrations support this PPL command, see Commands.

Syntax

Use the following syntax:

rename <source-field> AS <target-field>["," <source-field> AS <target-field>]...
source-field
  • Mandatory.

  • This is the name of the field you want to rename.

target-field
  • Mandatory.

  • This is the name you want to rename to.

Example 1: Rename one field

This example shows how to rename a single field.

PPL query:

os> source=accounts | rename account_number as an | fields an; fetched rows / total rows = 4/4 +------+ | an | |------| | 1 | | 6 | | 13 | | 18 | +------+
Example 2: Rename multiple fields

This example shows how to rename multiple fields.

PPL query:

os> source=accounts | rename account_number as an, employer as emp | fields an, emp; fetched rows / total rows = 4/4 +------+---------+ | an | emp | |------+---------| | 1 | Pyrami | | 6 | Netagy | | 13 | Quility | | 18 | null | +------+---------+
Limitations
  • Overriding existing field is unsupported:

    source=accounts | grok address '%{NUMBER} %{GREEDYDATA:address}' | fields address