Delete an index
You may wish to list all the indexes to verify the index name you wish to delete:
curl -s --location \
--request GET https://$ASTRA_CLUSTER_ID-$ASTRA_REGION.apps.astra.datastax.com/api/rest/v2/schemas/keyspaces/users_keyspace/tables/users/indexes \
--header "X-Cassandra-Token: $ASTRA_DB_APPLICATION_TOKEN" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
[
{
"keyspace_name": "users_keyspace",
"options": [
{
"key": "target",
"value": "current_country"
}
],
"table_name": "users",
"index_name": "country_idx",
"kind": "COMPOSITES"
},
{
"keyspace_name": "users_keyspace",
"options": [
{
"key": "target",
"value": "entries(evaluations)"
}
],
"table_name": "users",
"index_name": "evale_idx",
"kind": "COMPOSITES"
},
{
"keyspace_name": "users_keyspace",
"options": [
{
"key": "target",
"value": "keys(evaluations)"
}
],
"table_name": "users",
"index_name": "evalk_idx",
"kind": "COMPOSITES"
},
{
"keyspace_name": "users_keyspace",
"options": [
{
"key": "target",
"value": "values(evaluations)"
}
],
"table_name": "users",
"index_name": "evalv_idx",
"kind": "COMPOSITES"
},
{
"keyspace_name": "users_keyspace",
"options": [
{
"key": "target",
"value": "values(favorite_books)"
}
],
"table_name": "users",
"index_name": "fav_books_idx",
"kind": "COMPOSITES"
},
{
"keyspace_name": "users_keyspace",
"options": [
{
"key": "target",
"value": "values(top_three_tv_shows)"
}
],
"table_name": "users",
"index_name": "tv_idx",
"kind": "COMPOSITES"
}
]
Send a DELETE
request to
/api/rest/v2/schemas/keyspaces/users_keyspace/tables/users/indexes/{index_name}
to delete an index. All index data will be deleted along with the index schema.
curl -s --location \
--request DELETE https://$ASTRA_CLUSTER_ID-$ASTRA_REGION.apps.astra.datastax.com/api/rest/v2/schemas/keyspaces/users_keyspace/tables/users/indexes/fav_books_idx \
--header "X-Cassandra-Token: $ASTRA_DB_APPLICATION_TOKEN" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
If the call is successful, a 204
message is returned.