Drop an Index

Use the drop index operation to drop the vector index from a table.

The operation removes the index while preserving the table and its data. Queries will fall back to exact search until a new index is created. A table name is accepted as input.

See the following for an example using drop_index to drop an index and inspect the response.

from oracle_vecdb import OracleVecDB, Configuration

client = OracleVecDB(Configuration(
    rest_url="https://<host>/ords/<schema>/_/db-api/stable/vecdb/",
    access_token="<bearer-token>", # or username="<user>", password="<pass>"
))

result = client.drop_index(
    table_name="products",
    index_params={"index_type": "all"},
)

print(result)

A JSON response is returned confirming index deletion. An error is raised if the table or index does not exist.

Example response:

{
    "message": "Index drop request submitted."
}

For more information about the drop_index operation, see Python API Reference.

See how POST /vecdb/vector-indexes/{vector_table_name}/delete can be used in the following examples:

  • Drop vector indexes only:
    curl -X POST \
      "https://<host>:<port>/ords/<schema>/_/db-api/stable/vecdb/vector-indexes/product_vectors/delete" \
      -H "Content-Type: application/json" \
      -H "Accept: application/json" \
      # Choose ONE authentication method:
    
      # Option 1: Basic authentication
      -u "<user>:<password>" \
    
      # Option 2: OAuth Bearer token
      # -H "Authorization: Bearer <access_token>" \
    
      -d '{
        "indexParams": {
          "index_type": "vector"
        }
      }'
  • Drop selected metadata indexes:
    curl -X POST \
      "https://<host>:<port>/ords/<schema>/_/db-api/stable/vecdb/vector-indexes/product_vectors/delete" \
      -H "Content-Type: application/json" \
      -H "Accept: application/json" \
      # Choose ONE authentication method:
    
      # Option 1: Basic authentication
      -u "<user>:<password>" \
    
      # Option 2: OAuth Bearer token
      # -H "Authorization: Bearer <access_token>" \
    
      -d '{
        "indexParams": {
          "index_type": "metadata",
          "metadata_index_params": {
            "include_paths": ["tenant"]
          }
        }
      }'
  • Drop all indexes:
    curl -X POST \
      "https://<host>:<port>/ords/<schema>/_/db-api/stable/vecdb/vector-indexes/product_vectors/delete" \
      -H "Content-Type: application/json" \
      -H "Accept: application/json" \
      # Choose ONE authentication method:
    
      # Option 1: Basic authentication
      -u "<user>:<password>" \
    
      # Option 2: OAuth Bearer token
      # -H "Authorization: Bearer <access_token>" \
    
      -d '{
        "indexParams": {
          "index_type": "all"
        }
      }'

Responses:

  • Example 200 response:
    {
      "message": "MVI index(es) for paths [tenant] dropped successfully from table PRODUCT_VECTORS"
    }
  • 400 - the request body included invalid parameters.
  • 404 - the vector table was not found.

For more information about POST /vecdb/vector-indexes/{vector_table_name}/delete, see REST API Reference.

See how DBMS_VECTOR_DATABASE.DROP_INDEX can be used in the following example:

dbms_vector_database.drop_index(
    table_name => 'product_vectors',
    index_params => JSON('{
      "index_type": "metadata",
      "metadata_index_params": {
        "include_paths": ["category", "price"]
      }
    }')
);
Example response:
{
  "message": "MVI index(es) for paths [category, price] dropped successfully from table PRODUCT_VECTORS"
}

For more information about the PL/SQL implementation, including parameters, see DROP_INDEX.