List index metadata
Gets information about the indexes associated with a specific table.
|
Ready to write code? See the examples for this method to get started. If you are new to the Data API, check out the quickstart. |
Result
-
Python
-
TypeScript
-
Java
-
curl
Returns an unordered list of TableIndexDescriptor objects that describe each index in the table.
Returns a promise that resolves to an unordered list of TableIndexDescriptor objects that describe each index in the table.
Returns an unordered list of TableIndexDescriptor objects that describe each index in the table.
The status.indexes field in the response describes each index in the table.
Example response:
{
"status": {
"indexes": [
{
"name": "summary_genres_vector_index",
"definition": {
"column": "summary_genres_vector",
"options": { "metric": "cosine", "sourceModel": "other" }
},
"indexType": "vector"
},
{
"name": "rating_index",
"definition": { "column": "rating", "options": {} },
"indexType": "regular"
}
]
}
}
Parameters
-
Python
-
TypeScript
-
Java
-
curl
Use the list_indexes method, which belongs to the astrapy.table.Table class.
Method signature
(
*,
table_admin_timeout_ms: int,
request_timeout_ms: int,
timeout_ms: int,
) -> list[TableIndexDescriptor]
| Name | Type | Summary |
|---|---|---|
|
|
Optional.
A timeout, in milliseconds, for the underlying HTTP request.
If not provided, the |
Use the listIndexes method, which belongs to the Table class.
Method signature
async listIndexes(
options?: {
nameOnly?: false,
timeout?: number | TimeoutDescriptor,
}
): TableIndexDescriptor[]
| Name | Type | Summary |
|---|---|---|
|
|
Optional.
The options for this operation.
See Properties of |
| Name | Type | Summary |
|---|---|---|
|
|
Must be |
|
|
Optional. A timeout to impose on the underlying API request. |
Use the listIndexes method, which belongs to the com.datastax.astra.client.tables.Table class.
Method signature
List<TableIndexDescriptor> listIndexes()
List<TableIndexDescriptor> listIndexes(ListIndexesOptions options)
| Name | Type | Summary |
|---|---|---|
|
Optional. The options for this operation, including timeout. |
Use the listIndexes command.
Command signature
curl -sS -L -X POST "API_ENDPOINT/api/json/v1/KEYSPACE_NAME/TABLE_NAME" \
--header "Token: APPLICATION_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"listIndexes": {
"options": {
"explain": true
}
}
}'
| Name | Type | Summary |
|---|---|---|
|
|
Must be |
Examples
The following examples demonstrate how to get index metadata for a table.
List index metadata
-
Python
-
TypeScript
-
Java
-
curl
from astrapy import DataAPIClient
# Get an existing table
client = DataAPIClient()
database = client.get_database("API_ENDPOINT", token="APPLICATION_TOKEN")
table = database.get_table("TABLE_NAME")
# List indexes
result = table.list_indexes()
print(result)
import { DataAPIClient, date } from "@datastax/astra-db-ts";
// Get an existing table
const client = new DataAPIClient();
const database = client.db("API_ENDPOINT", {
token: "APPLICATION_TOKEN",
});
const table = database.table("TABLE_NAME");
// List indexes
(async function () {
const result = await table.listIndexes({ nameOnly: false });
console.log(result);
})();
import com.datastax.astra.client.DataAPIClient;
import com.datastax.astra.client.tables.Table;
import com.datastax.astra.client.tables.definition.rows.Row;
public class Example {
public static void main(String[] args) {
// Get an existing table
Table<Row> table =
new DataAPIClient("APPLICATION_TOKEN")
.getDatabase("API_ENDPOINT")
.getTable("TABLE_NAME");
// List indexes
table.listIndexes().forEach(index -> System.out.println(index));
}
}
curl -sS -L -X POST "API_ENDPOINT/api/json/v1/KEYSPACE_NAME/TABLE_NAME" \
--header "Token: APPLICATION_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"listIndexes": {
"options": {
"explain": true
}
}
}'
Client reference
-
Python
-
TypeScript
-
Java
-
curl
For more information, see the client reference.
For more information, see the client reference.
For more information, see the client reference.
Client reference documentation is not applicable for HTTP.