Skip to main content

indexes

Creates, updates, deletes, gets or lists an indexes resource.

Overview

Nameindexes
TypeResource
Iddatabricks_workspace.vectorsearch.indexes

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringName of the index
endpoint_namestringName of the endpoint associated with the index
creatorstring
delta_sync_index_specobject
direct_access_index_specobject
index_typestringThere are 2 types of Vector Search indexes: - `DELTA_SYNC`: An index that automatically syncs<br />with a source Delta Table, automatically and incrementally updating the index as the underlying<br />data in the Delta Table changes. - `DIRECT_ACCESS`: An index that supports direct read and write<br />of vectors and metadata through our REST and SDK APIs. With this model, the user manages index<br />updates. (DELTA_SYNC, DIRECT_ACCESS)
primary_keystringPrimary key of the index
statusobject

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectindex_name, deployment_nameensure_reranker_compatibleGet an index.
listselectendpoint_name, deployment_namepage_tokenList all indexes in the given endpoint.
createinsertdeployment_name, name, endpoint_name, primary_key, index_typeCreate a new index.
deletedeleteindex_name, deployment_nameDelete an index.
delete_data_vector_indexexecindex_name, primary_keys, deployment_nameHandles the deletion of data from a specified vector index.
query_indexexecindex_name, deployment_name, columnsQuery the specified vector index.
query_next_pageexecindex_name, deployment_nameUse next_page_token returned from previous QueryVectorIndex or QueryVectorIndexNextPage request
scan_indexexecindex_name, deployment_nameScan the specified vector index and return the first num_results entries after the exclusive
sync_indexexecindex_name, deployment_nameTriggers a synchronization process for a specified vector index.
upsert_data_vector_indexexecindex_name, deployment_name, inputs_jsonHandles the upserting of data into a specified vector index.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
deployment_namestringThe Databricks Workspace Deployment Name (default: dbc-abcd0123-a1bc)
endpoint_namestringName of the endpoint
index_namestringName of the vector index where data is to be upserted. Must be a Direct Vector Access Index.
primary_keysarrayList of primary keys for the data to be deleted.
ensure_reranker_compatiblebooleanIf true, the URL returned for the index is guaranteed to be compatible with the reranker. Currently this means we return the CP URL regardless of how the index is being accessed. If not set or set to false, the URL may still be compatible with the reranker depending on what URL we return.
page_tokenstringToken for pagination

SELECT examples

Get an index.

SELECT
name,
endpoint_name,
creator,
delta_sync_index_spec,
direct_access_index_spec,
index_type,
primary_key,
status
FROM databricks_workspace.vectorsearch.indexes
WHERE index_name = '{{ index_name }}' -- required
AND deployment_name = '{{ deployment_name }}' -- required
AND ensure_reranker_compatible = '{{ ensure_reranker_compatible }}'
;

INSERT examples

Create a new index.

INSERT INTO databricks_workspace.vectorsearch.indexes (
name,
endpoint_name,
primary_key,
index_type,
delta_sync_index_spec,
direct_access_index_spec,
deployment_name
)
SELECT
'{{ name }}' /* required */,
'{{ endpoint_name }}' /* required */,
'{{ primary_key }}' /* required */,
'{{ index_type }}' /* required */,
'{{ delta_sync_index_spec }}',
'{{ direct_access_index_spec }}',
'{{ deployment_name }}'
RETURNING
name,
endpoint_name,
creator,
delta_sync_index_spec,
direct_access_index_spec,
index_type,
primary_key,
status
;

DELETE examples

Delete an index.

DELETE FROM databricks_workspace.vectorsearch.indexes
WHERE index_name = '{{ index_name }}' --required
AND deployment_name = '{{ deployment_name }}' --required
;

Lifecycle Methods

Handles the deletion of data from a specified vector index.

EXEC databricks_workspace.vectorsearch.indexes.delete_data_vector_index 
@index_name='{{ index_name }}' --required,
@primary_keys='{{ primary_keys }}' --required,
@deployment_name='{{ deployment_name }}' --required
;