Runs vector search through the engine planner and returns the best matches with scores and optional metadata.
Search responses return a bounded list of matches ordered by the engine. They are not cursor pages unless a later command explicitly advertises pagination.
Examples
Find the nearest vectors to a query vector.
CLI
$ strata vector collection create docs 3 cosine
$ strata vector upsert docs a [1.0,0.0,0.0]
$ strata vector upsert docs b [0.0,1.0,0.0]
$ strata vector query docs [1.0,0.0,0.0] 2
Wire
{"collection":"docs","dimension":3,"metric":"cosine","type":"vector_create_collection"}
{"collection":"docs","key":"a","type":"vector_upsert","vector":[1.0,0.0,0.0]}
{"collection":"docs","key":"b","type":"vector_upsert","vector":[0.0,1.0,0.0]}
{"collection":"docs","k":2,"query":[1.0,0.0,0.0],"type":"vector_query"}
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
as_of | integer | no | Optional timestamp in microseconds. |
collection | string | yes | Collection name. |
filter | VectorMetadataFilter | no | Optional metadata filter. |
k | integer | yes | Maximum number of matches. |
query | number[] | yes | Query embedding. |
Plus the optional scope: branch and space (default to the session branch and the "default" space).
Returns
SearchResult<VectorMatch>.
Errors
failed_precondition.engine.runtime_closednot_found.engine.branchinvalid_argument.engine.product_spaceinvalid_argument.engine.vector_collectioninvalid_argument.engine.vector_keynot_found.engine.vector_collectioninvalid_argument.engine.vector_filterinvalid_argument.executor.vector_limit
Invocation
- CLI:
strata vector query - Wire type:
vector_query