query
method supports two calling patterns:
Parameter | Type | Default | Description |
---|---|---|---|
queryVector | number[] | number[][] | - | Single vector (1D array) or multiple vectors (2D array) to search for |
topK | number | 100 | (Optional) Number of nearest neighbors to return for each query |
nProbes | number | 1 | (Optional) Number of lists to probe during the query (affects accuracy vs speed tradeoff) |
greedy | boolean | false | (Optional) Whether to use greedy search algorithm |
filters | object | {} | (Optional) Metadata filters to apply to the search |
include | string[] | ["distance", "metadata"] | (Optional) Fields to include in results: "distance" , "metadata" , "vector" , "contents" |
Parameter | Type | Description |
---|---|---|
request | QueryRequest | Complete query request object with all parameters |
Promise<QueryResponse>
: A Promise that resolves to search results. The response format depends on whether a single vector or multiple vectors were queried:
results
is a flat array of QueryResultItem[]
results
is a nested array of QueryResultItem[][]
(one array per input vector)Error
Validation Errors
include
parameter contains invalid field names.Field | Type | Description |
---|---|---|
id | string | Unique identifier of the matching vector |
distance | number | Similarity distance (lower values indicate higher similarity) |
metadata | any | Associated metadata (included if "metadata" in include array) |
vector | number[] | The vector data (included if "vector" in include array) |
contents | string | The content data (included if "contents" in include array) |