Skip to main content
A vector query finds the k nearest vectors to a query vector or query text, as measured by a similarity metric.

Parameters

Provide exactly one of queryVector, queryText, or queryInputs. queryText and queryInputs require a native embedding vector field. Dense fields support cosine or euclidean similarity and must fit the dimension limits. queryVector must match the field’s dimensions and contain only finite numbers; cosine queries must have nonzero magnitude. The nodeSize parameter is not supported. The JSON examples below are query objects: place them under the request body’s query, alongside options such as size. See Search overview for complete SDK requests. When using native reranking, rerank.candidateSize limits the merged rerank pool and does not automatically increase k.

Examples

The raw-vector examples use synthetic 64-dimensional vectors and assume fields configured with dimensions: 64. Use your model’s full query vector for real searches.

Simple vector query

Native embedding vector query

Use queryText when the target field is a native embedding vector field. LambdaDB generates the query vector with the field’s model before retrieval. Supported providers and models are listed in Native embeddings.
For a Cohere field, queryInputs combines ordered text and image parts into one query vector. An image value is a public HTTPS URL or a data URI, with the same image limits as document writes. OpenAI fields accept a single text part.
A native embedding field also accepts queryVector. Use it when you already have a vector from the same model; the query then runs without inference.

Multi-field vector query

You can search across multiple vector fields simultaneously by wrapping multiple kNN objects in a boolean query. This is useful when you have different types of embeddings (e.g., text embedding and image embedding) and want to combine their results.

Vector query with filter query

An example vector query with a filter for better performance and relevance: