Query index information about tables
You can execute the show index statement to query the index information about a table, such the index name, index fields, and index type.
For more information about the SHOW INDEX statement, see Query the index information about a table.
Prerequisites
A Tablestore client is initialized. For more information, see Initialize a Tablestore client.
Parameters
|
Parameter |
Description |
|
query |
The SQL statement. Configure this parameter based on the required feature. |
Example
The following sample code provides an example on how to execute the show index in test_table statement to query the index information about a table named test_table:
const params = {
query: "show index in test_table",
}
client.sqlQuery(params, function (err, data) {
if (err) {
console.log('sqlQuery error:', err.toString());
} else {
console.log('sqlQuery success:', data);
}
});
References
-
If you want to use a specific search index to query data when you use the SQL query feature, you can execute the
CREATE TABLEstatement to create a mapping table for the search index. For more information, see Create mapping tables for search indexes. -
You can execute SQL statements to query data based on the fields of an index. For more information, see Query data.