OpenSearch/docs/reference/sql/language/syntax/show-tables.asciidoc
Costin Leau 17c7f99343
SQL: Show/desc commands now support table ids (#33363)
Extend SHOW TABLES, DESCRIBE and SHOW COLUMNS to support table
identifiers not just SQL LIKE pattern.
This allows both Elasticsearch-style multi-index patterns and SQL LIKE.
To disambiguate between the two (as the " vs ' can be easy to miss),
the grammar now requires LIKE keyword as a prefix for all LIKE-like
patterns.

Also added some docs comparing the two types of patterns.

Fix #33294
2018-09-04 16:54:10 +03:00

62 lines
1.4 KiB
Plaintext

[role="xpack"]
[testenv="basic"]
[[sql-syntax-show-tables]]
=== SHOW TABLES
.Synopsis
[source, sql]
----
SHOW TABLES [ table identifier<1> | [ LIKE pattern<2> ] ]?
----
<1> single table identifier or double quoted es multi index
<2> SQL LIKE pattern
See <<sql-index-pattern, index patterns>> for more information about
patterns.
.Description
List the tables available to the current user and their type.
["source","sql",subs="attributes,callouts,macros"]
----
include-tagged::{sql-specs}/docs.csv-spec[showTables]
----
Match multiple indices by using {es} <<multi-index,multi index syntax>>
notation:
["source","sql",subs="attributes,callouts,macros"]
----
include-tagged::{sql-specs}/docs.csv-spec[showTablesEsMultiIndex]
----
One can also use the `LIKE` clause to restrict the list of names to the given pattern.
The pattern can be an exact match:
["source","sql",subs="attributes,callouts,macros"]
----
include-tagged::{sql-specs}/docs.csv-spec[showTablesLikeExact]
----
Multiple chars:
["source","sql",subs="attributes,callouts,macros"]
----
include-tagged::{sql-specs}/docs.csv-spec[showTablesLikeWildcard]
----
A single char:
["source","sql",subs="attributes,callouts,macros"]
----
include-tagged::{sql-specs}/docs.csv-spec[showTablesLikeOneChar]
----
Or a mixture of single and multiple chars:
["source","sql",subs="attributes,callouts,macros"]
----
include-tagged::{sql-specs}/docs.csv-spec[showTablesLikeMixed]
----