List index names
Gets the names of the indexes for a 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
-
Go
-
Java
-
C#
-
curl
Returns the index names for a table as an unordered list of strings.
Returns a promise that resolves to the index names for a table as an unordered list of strings.
|
The Go client is in preview. For more information, see astra-db-go. |
Returns the index names for a table as an unordered slice of strings.
Returns the index names for a table as an unordered list of strings.
Returns the index names for a table as an unordered list of strings.
Returns the index names for a table as an unordered list of strings in the status.indexes field of the response.
Example response:
{
"status": {
"indexes": [
"index_name_1",
"index_name_2"
]
}
}
Parameters
-
Python
-
TypeScript
-
Go
-
Java
-
C#
-
curl
Use the list_index_names method, which belongs to the astrapy.Table class.
Method signature
list_index_names(
*,
table_admin_timeout_ms: int,
request_timeout_ms: int,
timeout_ms: int,
) -> list[str]
| 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?: ListIndexOptions & {
nameOnly: true,
timeout?: number | TimeoutDescriptor,
}
): TableIndexDescriptor[]
| Name | Type | Summary |
|---|---|---|
|
|
The options for this operation.
See Properties of |
| Name | Type | Summary |
|---|---|---|
|
|
Must be |
|
|
Optional. A timeout to impose on the underlying API request. |
|
The Go client is in preview. For more information, see astra-db-go. |
Use the ListIndexNames method, which belongs to the Table type.
Method signature
func (t *Table) ListIndexNames(
ctx context.Context,
opts ...options.ListIndexesOption
) ([]string, error)
| Name | Type | Summary |
|---|---|---|
|
|
The context for the operation. |
|
Optional.
A builder to generate options for this operation.
See Methods of the |
| Method | Summary |
|---|---|
|
Optional. General API options for this operation, including the timeout. |
Use the listIndexesNames method, which belongs to the com.datastax.astra.client.tables.Table class.
Method signature
List<String> listIndexesNames()
List<String> listIndexesNames(ListIndexesOptions listIndexesOptions)
| Name | Type | Summary |
|---|---|---|
|
Optional. The options for this operation, including timeout. |
Use the ListIndexNamesAsync method, which belongs to the Table class.
You can also use ListIndexNames, which is the synchronous version of the method.
Method signature
public Task<List<string>> ListIndexNamesAsync(
ListIndexNamesOptions options = null
);
| Name | Type | Summary |
|---|---|---|
|
Optional. General API options for this operation, including the keyspace and timeout. For more information and examples, see Customize API interaction. |
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": false
}
}
}'
| Name | Type | Summary |
|---|---|---|
|
|
Must be |
Examples
The following examples demonstrate how to get the names of the indexes for a table.
List index names
-
Python
-
TypeScript
-
Go
-
Java
-
C#
-
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 index names
result = table.list_index_names()
print(result)
import { DataAPIClient } 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 index names
(async function () {
const result = await table.listIndexes({ nameOnly: true });
console.log(result);
})();
|
The Go client is in preview. For more information, see astra-db-go. |
package main
import (
"context"
"fmt"
"log"
"github.com/datastax/astra-db-go/v2/astra"
"github.com/datastax/astra-db-go/v2/astra/options"
)
func main() {
ctx := context.Background()
// Get an existing table
client := astra.NewClient()
database := client.Database(
"API_ENDPOINT",
options.API().SetToken("APPLICATION_TOKEN"),
)
table := database.Table("TABLE_NAME")
// List index names
names, err := table.ListIndexNames(ctx)
if err != nil {
log.Fatal(err)
}
fmt.Println(names)
}
import com.datastax.astra.client.DataAPIClient;
import com.datastax.astra.client.tables.Table;
import com.datastax.astra.client.tables.definition.rows.Row;
import java.util.List;
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 index names
List<String> result = table.listIndexesNames();
System.out.println(result);
}
}
using System.Text.Json;
using DataStax.AstraDB.DataApi;
namespace Examples;
public class Program
{
static async Task Main()
{
// Get an existing table
var client = new DataAPIClient();
var database = client.GetDatabase(
"API_ENDPOINT",
"APPLICATION_TOKEN"
);
var table = database.GetTable("TABLE_NAME");
// List index names
var names = await table.ListIndexNamesAsync();
Console.WriteLine(JsonSerializer.Serialize(names));
}
}
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": false
}
}
}'
Client reference
-
Python
-
TypeScript
-
Go
-
Java
-
C#
-
curl
For more information, see the client reference.
For more information, see the client reference.
|
The Go client is in preview. For more information, see astra-db-go. |
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.