Drop an index

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.

Deletes an index from a table in a Serverless (Vector) database.

Method signature

  • Python

  • TypeScript

  • Java

  • curl

The following method belongs to the astrapy.Database class.

drop_table_index(
  name: str,
  *,
  keyspace: str,
  if_exists: bool,
  table_admin_timeout_ms: int,
  request_timeout_ms: int,
  timeout_ms: int,
) -> None

The following method belongs to the Db class.

async dropTableIndex(
  name: string,
  options?: {
    ifExists?: boolean,
    timeout?: number | TimeoutDescriptor,
    keyspace?: string,
  }
): void

The following methods belong to the com.datastax.astra.client.databases.Database class.

void dropTableIndex(String indexName)
void dropTableIndex(
  String indexName,
  DropTableIndexOptions dropIndexOptions
)
curl -sS -L -X POST "ASTRA_DB_API_ENDPOINT/api/json/v1/ASTRA_DB_KEYSPACE" \
--header "Token: ASTRA_DB_APPLICATION_TOKEN" \
--header "Content-Type: application/json" \
--data '{
  "dropIndex": {
      "name": "INDEX_NAME"
  }
}'

Result

  • Python

  • TypeScript

  • Java

  • curl

Deletes the specified index.

Does not return anything.

Deletes the specified index.

Returns a promise that resolves once the operation completes.

Deletes the specified index.

Does not return anything.

Deletes the specified index from the a table.

If the command succeeds, the response indicates the success.

Example response:

{
  "status": {
    "ok": 1
  }
}

Parameters

  • Python

  • TypeScript

  • Java

  • curl

Name Type Summary

name

str

The name of the index to delete.

keyspace

str | None

The keyspace where you created the index. If unspecified, the database’s default keyspace setting is used.

if_exists

bool | None

If True, and an index with the given name doesn’t exist in the keyspace, then the command succeeds and silently does nothing. In this case, no actual index deletion occurs.

If False (default), an error occurs if an index with the specified name does not exist in the keyspace.

table_admin_timeout_ms

int | None

A timeout, in milliseconds, to impose on the underlying API request. If not provided, the Database defaults apply. This parameter is aliased as request_timeout_ms and timeout_ms for convenience.

Name Type Summary

name

string

The name of the index to delete.

option?

TableDropIndexOptions

The options for this operation.

Options (TableDropIndexOptions):

Name Type Summary

ifExists?

boolean

If true, and an index with the given name doesn’t exist in the keyspace, then the command succeeds and silently does nothing. In this case, no actual index deletion occurs.

If false (default), an error occurs if an index with the specified name does not exist in the keyspace.

timeout?

number | TimeoutDescriptor

The client-side timeout for this operation.

Name Type Summary

name

str

Name of the index to drop

options

DropTableIndexOptions

Specialization of index deletion options, including ifExists, 'keyspace` and timeout.

If ifExists(true), and an index with the given name doesn’t exist in the keyspace, then the command succeeds and silently does nothing. In this case, no actual index deletion occurs.

If ifExists(false) (default), an error occurs if an index with the specified name does not exist in the keyspace.

Name Type Summary

dropIndex

command

The Data API command to delete an index from a Serverless (Vector) database. It acts as a container for all the attributes and settings required to delete the index.

name

string

The name of the index to delete.

Examples

The following examples demonstrate how to drop an index from a table.

Drop an index

  • Python

  • TypeScript

  • Java

  • curl

from astrapy import DataAPIClient

# Get a database
client = DataAPIClient("ASTRA_DB_APPLICATION_TOKEN")
database = client.get_database("ASTRA_DB_API_ENDPOINT")

# Drop an index
database.drop_table_index("rating")
import { DataAPIClient } from '@datastax/astra-db-ts';

// Get a database
const client = new DataAPIClient('ASTRA_DB_APPLICATION_TOKEN');
const database = client.db('ASTRA_DB_API_ENDPOINT');

// Drop an index
(async function () {
  await database.dropTableIndex("rating");
})();
package com.example;

import com.datastax.astra.client.DataAPIClient;
import com.datastax.astra.client.databases.Database;

import java.util.List;

public class DropIndex {

    public static void main(String[] args) {
        // Get a database
        Database database = new DataAPIClient("ASTRA_DB_APPLICATION_TOKEN")
            .getDatabase("ASTRA_DB_API_ENDPOINT");

        // Drop an index
        database.dropTableIndex("rating");
    }
}
curl -sS -L -X POST "ASTRA_DB_API_ENDPOINT/api/json/v1/ASTRA_DB_KEYSPACE/ASTRA_DB_TABLE" \
--header "Token: ASTRA_DB_APPLICATION_TOKEN" \
--header "Content-Type: application/json" \
--data '{
  "dropIndex": {
      "name": "rating"
  }
}'

Drop an index only if the index exists

Use this option to silently do nothing if an index with the specified name does not exist.

  • Python

  • TypeScript

  • Java

  • curl

from astrapy import DataAPIClient

# Get a database
client = DataAPIClient("ASTRA_DB_APPLICATION_TOKEN")
database = client.get_database("ASTRA_DB_API_ENDPOINT")

# Drop an index
database.drop_table_index("rating", if_exists=True)
import { DataAPIClient } from '@datastax/astra-db-ts';

// Get a database
const client = new DataAPIClient('ASTRA_DB_APPLICATION_TOKEN');
const database = client.db('ASTRA_DB_API_ENDPOINT');

// Drop an index
(async function () {
  await database.dropTableIndex("rating", { ifExists: true });
})();
package com.example;

import com.datastax.astra.client.DataAPIClient;
import com.datastax.astra.client.databases.Database;
import com.datastax.astra.client.tables.commands.options.DropTableIndexOptions;

import java.util.List;

public class DropIndex {

    public static void main(String[] args) {
        // Get a database
        Database database = new DataAPIClient("ASTRA_DB_APPLICATION_TOKEN")
            .getDatabase("ASTRA_DB_API_ENDPOINT");

        // Drop an index
        DropTableIndexOptions options = new DropTableIndexOptions()
            .ifExists(true);

        database.dropTableIndex("rating", options);
    }
}

This option has no literal equivalent in HTTP. Instead, you can list the index names to see if an index with the name already exists.

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.

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2025 DataStax | Privacy policy | Terms of use | Manage Privacy Choices

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: +1 (650) 389-6000, info@datastax.com