Skip to content

Latest commit

 

History

History
67 lines (52 loc) · 6.75 KB

File metadata and controls

67 lines (52 loc) · 6.75 KB

describe

Description

Use the describe command to query metadata of the index. describe command can only be used as the first command in the PPL query.

Syntax

describe [dataSource.][schema.]<tablename>

  • dataSource: optional. If dataSource is not provided, it resolves to opensearch dataSource.
  • schema: optional. If schema is not provided, it resolves to default schema.
  • tablename: mandatory. describe command must specify which tablename to query from.

Example 1: Fetch all the metadata

This example describes the accounts index.

describe accounts

Expected output:

fetched rows / total rows = 11/11
+----------------+-------------+------------+----------------+-----------+-----------+-------------+---------------+----------------+----------------+----------+---------+------------+---------------+------------------+-------------------+------------------+-------------+---------------+--------------+-------------+------------------+------------------+--------------------+
| TABLE_CAT      | TABLE_SCHEM | TABLE_NAME | COLUMN_NAME    | DATA_TYPE | TYPE_NAME | COLUMN_SIZE | BUFFER_LENGTH | DECIMAL_DIGITS | NUM_PREC_RADIX | NULLABLE | REMARKS | COLUMN_DEF | SQL_DATA_TYPE | SQL_DATETIME_SUB | CHAR_OCTET_LENGTH | ORDINAL_POSITION | IS_NULLABLE | SCOPE_CATALOG | SCOPE_SCHEMA | SCOPE_TABLE | SOURCE_DATA_TYPE | IS_AUTOINCREMENT | IS_GENERATEDCOLUMN |
|----------------+-------------+------------+----------------+-----------+-----------+-------------+---------------+----------------+----------------+----------+---------+------------+---------------+------------------+-------------------+------------------+-------------+---------------+--------------+-------------+------------------+------------------+--------------------|
| docTestCluster | null        | accounts   | account_number | null      | bigint    | null        | null          | null           | 10             | 2        | null    | null       | null          | null             | null              | 0                |             | null          | null         | null        | null             | NO               |                    |
| docTestCluster | null        | accounts   | firstname      | null      | string    | null        | null          | null           | 10             | 2        | null    | null       | null          | null             | null              | 1                |             | null          | null         | null        | null             | NO               |                    |
| docTestCluster | null        | accounts   | address        | null      | string    | null        | null          | null           | 10             | 2        | null    | null       | null          | null             | null              | 2                |             | null          | null         | null        | null             | NO               |                    |
| docTestCluster | null        | accounts   | balance        | null      | bigint    | null        | null          | null           | 10             | 2        | null    | null       | null          | null             | null              | 3                |             | null          | null         | null        | null             | NO               |                    |
| docTestCluster | null        | accounts   | gender         | null      | string    | null        | null          | null           | 10             | 2        | null    | null       | null          | null             | null              | 4                |             | null          | null         | null        | null             | NO               |                    |
| docTestCluster | null        | accounts   | city           | null      | string    | null        | null          | null           | 10             | 2        | null    | null       | null          | null             | null              | 5                |             | null          | null         | null        | null             | NO               |                    |
| docTestCluster | null        | accounts   | employer       | null      | string    | null        | null          | null           | 10             | 2        | null    | null       | null          | null             | null              | 6                |             | null          | null         | null        | null             | NO               |                    |
| docTestCluster | null        | accounts   | state          | null      | string    | null        | null          | null           | 10             | 2        | null    | null       | null          | null             | null              | 7                |             | null          | null         | null        | null             | NO               |                    |
| docTestCluster | null        | accounts   | age            | null      | bigint    | null        | null          | null           | 10             | 2        | null    | null       | null          | null             | null              | 8                |             | null          | null         | null        | null             | NO               |                    |
| docTestCluster | null        | accounts   | email          | null      | string    | null        | null          | null           | 10             | 2        | null    | null       | null          | null             | null              | 9                |             | null          | null         | null        | null             | NO               |                    |
| docTestCluster | null        | accounts   | lastname       | null      | string    | null        | null          | null           | 10             | 2        | null    | null       | null          | null             | null              | 10               |             | null          | null         | null        | null             | NO               |                    |
+----------------+-------------+------------+----------------+-----------+-----------+-------------+---------------+----------------+----------------+----------+---------+------------+---------------+------------------+-------------------+------------------+-------------+---------------+--------------+-------------+------------------+------------------+--------------------+

Example 2: Fetch metadata with condition and filter

This example retrieves columns with type bigint in the accounts index.

describe accounts
| where TYPE_NAME="bigint"
| fields COLUMN_NAME

Expected output:

fetched rows / total rows = 3/3
+----------------+
| COLUMN_NAME    |
|----------------|
| account_number |
| balance        |
| age            |
+----------------+

Example 3: Fetch metadata for table in Prometheus datasource

See Fetch metadata for table in Prometheus datasource for more context.