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_idstringID of the endpoint associated with the index.
endpoint_namestringName of the endpoint associated with the index
creatorstring
â–¶delta_sync_index_specobject
â–¶direct_access_index_specobject
index_subtypestringThe subtype of the index. (FULL_TEXT, HYBRID, VECTOR)
index_typestringThere are 2 types of AI Search indexes:<br /><br />- ``DELTA_SYNC``: An index that automatically syncs with a source Delta Table, automatically and<br /> incrementally updating the index as the underlying data in the Delta Table changes.<br />- ``DIRECT_ACCESS``: An index that supports direct read and write of vectors and metadata<br /> through our REST and SDK APIs. With this model, the user manages index 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_name, workspace_domainensure_reranker_compatibleGet an index.
listselectendpoint_name, deployment_name, workspace_domainpage_tokenList all indexes in the given endpoint.
createinsertdeployment_name, workspace_domain, name, endpoint_name, primary_key, index_typeCreate a new index.
deletedeleteindex_name, deployment_name, workspace_domainDelete an index.
delete_data_vector_indexexecindex_name, primary_keys, deployment_name, workspace_domainHandles the deletion of data from a specified vector index.
query_indexexecindex_name, deployment_name, workspace_domain, columnsQuery the specified vector index.
query_next_pageexecindex_name, deployment_name, workspace_domainUse next_page_token returned from previous QueryVectorIndex or QueryVectorIndexNextPage
scan_indexexecindex_name, deployment_name, workspace_domainScan the specified vector index and return the first num_results entries after the exclusive
sync_indexexecindex_name, deployment_name, workspace_domainTriggers a synchronization process for a specified vector index.
upsert_data_vector_indexexecindex_name, deployment_name, workspace_domain, 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: the host prefix of the workspace URL (dbc-abcd0123-a1bc on AWS, adb-1234567890123456.7 on Azure, 1234567890123456.7 on GCP). Set DATABRICKS_DEPLOYMENT_NAME to default it for the session. (default: dbc-abcd0123-a1bc, x-stackQL-envVar: DATABRICKS_DEPLOYMENT_NAME)
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.
workspace_domainstringThe Databricks workspace domain suffix for the cloud. Selected by DATABRICKS_CLOUD (aws, azure or gcp; default aws). (default: cloud.databricks.com, x-stackQL-envVarSelector: {"envVar":"DATABRICKS_CLOUD","default":"aws","values":{"aws":"cloud.databricks.com","azure":"azuredatabricks.net","gcp":"gcp.databricks.com"}})
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_id,
endpoint_name,
creator,
delta_sync_index_spec,
direct_access_index_spec,
index_subtype,
index_type,
primary_key,
status
FROM databricks_workspace.vectorsearch.indexes
WHERE index_name = '{{ index_name }}' -- required
AND deployment_name = '{{ deployment_name }}' -- required
AND workspace_domain = '{{ workspace_domain }}' -- 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,
index_subtype,
deployment_name,
workspace_domain
)
SELECT
'{{ name }}' /* required */,
'{{ endpoint_name }}' /* required */,
'{{ primary_key }}' /* required */,
'{{ index_type }}' /* required */,
'{{ delta_sync_index_spec }}',
'{{ direct_access_index_spec }}',
'{{ index_subtype }}',
'{{ deployment_name }}',
'{{ workspace_domain }}'
RETURNING
name,
endpoint_id,
endpoint_name,
creator,
delta_sync_index_spec,
direct_access_index_spec,
index_subtype,
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
AND workspace_domain = '{{ workspace_domain }}' --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,
@workspace_domain='{{ workspace_domain }}' --required
;