List index metadata
Tables with the Data API are currently in public preview. Development is ongoing, and the features and functionality are subject to change. Astra DB Serverless, and the use of such, is subject to the DataStax Preview Terms. |
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.
The TypeScript client does not support this method.
Use direct HTTP requests instead, as demonstrated on the curl
tab.
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 |
The TypeScript client does not support this method.
Use direct HTTP requests instead, as demonstrated on the curl
tab.
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. Options for the method, 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("APPLICATION_TOKEN")
database = client.get_database("API_ENDPOINT")
table = database.get_table("TABLE_NAME")
# List indexes
result = table.list_indexes()
print(result)
The TypeScript client does not support this method.
Use direct HTTP requests instead, as demonstrated on the curl
tab.
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.
The TypeScript client does not support this method.
Use direct HTTP requests instead, as demonstrated on the curl
tab.
For more information, see the client reference.
Client reference documentation is not applicable for HTTP.