Rebuild an Index
Use the rebuild index operation to rebuild an existing
vector index with updated parameters.
The operation recreates the existing index, optionally with new configuration parameters. This is useful for optimizing search performance or adjusting to changed data distributions. The rebuild runs asynchronously as a background job.
See the following for an example of an index rebuild. In this case, all indexes are rebuilt with parallel DDL:
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>"
))
response = client.rebuild_index(
table_name='products',
index_params={
'index_type': 'all',
'parallel_creation': 4
}
)
print(response)A JSON response is returned containing the rebuild job ID and status.
For more information about the rebuild_index
operation, see Python API Reference.
See how POST
/vecdb/vector-indexes/{vector_table_name} can be used in the
following examples:
- Vector-only
rebuild:
curl -X POST \ "https://<host>:<port>/ords/<schema>/_/db-api/stable/vecdb/vector-indexes/product_vectors" \ -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", "parallel_creation": 4 } }' - Metadata-only
rebuild:
curl -X POST \ "https://<host>:<port>/ords/<schema>/_/db-api/stable/vecdb/vector-indexes/product_vectors" \ -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"] } } }' - All-index
rebuild:
curl -X POST \ "https://<host>:<port>/ords/<schema>/_/db-api/stable/vecdb/vector-indexes/product_vectors" \ -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", "parallel_creation": 4 } }'
Responses:
- Example 200
response:
{ "job_creator": "APPUSER", "job_name": "VECDB_REBUILD_INDEX_20260501103000", "job_type": "PLSQL_BLOCK", "operation": "REBUILD", "state": "RUNNING", "start_date": "2026-05-01T10:30:00.118886Z", "links": [ { "href": "/vecdb/vector-indexes/jobs/", "rel": "collection" }, { "href": "/vecdb/vector-indexes/jobs/vecdb_rebuild_index_20260501103000/", "rel": "self" }, { "href": "/vecdb/vector-indexes/jobs/vecdb_rebuild_index_20260501103000/jobfile", "rel": "related" } ] } - 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}, see REST API Reference.
See how DBMS_VECTOR_DATABASE.REBUILD_INDEX can be
used in the following example:
dbms_vector_database.rebuild_index(
table_name => 'product_vectors',
index_params => JSON('{
"vector_index_params": {
"auto_index": true,
"organization": "INMEMORY GRAPH",
"distance_metric": "COSINE",
"advanced_params": {
"neighbors": 32,
"efConstruction": 128,
"rescore_factor": 4
}
},
"parallel_creation": 2
}')
);{
"message": "Vector index VECIDX_PRODUCT_VECTORS_20260501T100000 Rebuild successfully for table PRODUCT_VECTORS"
}For more information about the PL/SQL implementation, including parameters, see REBUILD_INDEX.