Query a Vector Search Index
Arguments
- index
Name of vector search index
- columns
Column names to include in response
- filters_json
JSON string representing query filters, see details.
- query_vector
Numeric vector. Required for direct vector access index and delta sync index using self managed vectors.
- query_text
Required for delta sync index using model endpoint.
- score_threshold
Numeric score threshold for the approximate nearest neighbour (ANN) search. Defaults to 0.0.
- query_type
One of
ANN
(default) orHYBRID
- num_results
Number of returns to return (default: 10).
- host
Databricks workspace URL, defaults to calling
db_host()
.- token
Databricks workspace token, defaults to calling
db_token()
.- perform_request
If
TRUE
(default) the request is performed, ifFALSE
the httr2 request is returned without being performed.
Details
You cannot specify both query_vector
and query_text
at the same time.
filter_jsons
examples:
'{"id <": 5}'
: Filter for id less than 5'{"id >": 5}'
: Filter for id greater than 5'{"id <=": 5}'
: Filter for id less than equal to 5'{"id >=": 5}'
: Filter for id greater than equal to 5'{"id": 5}'
: Filter for id equal to 5'{"id": 5, "age >=": 18}'
: Filter for id equal to 5 and age greater than equal to 18
filter_jsons
will convert attempt to use jsonlite::toJSON
on any
non character vectors.
Refer to docs for Vector Search.
See also
Other Vector Search API:
db_vs_endpoints_create()
,
db_vs_endpoints_delete()
,
db_vs_endpoints_get()
,
db_vs_endpoints_list()
,
db_vs_indexes_create()
,
db_vs_indexes_delete()
,
db_vs_indexes_delete_data()
,
db_vs_indexes_get()
,
db_vs_indexes_list()
,
db_vs_indexes_query_next_page()
,
db_vs_indexes_scan()
,
db_vs_indexes_sync()
,
db_vs_indexes_upsert_data()
,
delta_sync_index_spec()
,
direct_access_index_spec()
,
embedding_source_column()
,
embedding_vector_column()
Examples
if (FALSE) { # \dontrun{
db_vs_indexes_sync(
index = "myindex",
columns = c("id", "text"),
query_vector = c(1, 2, 3)
)
} # }