Skip to main content
Searches for nearest neighbors in the encrypted index using vector similarity search. Supports both single vector queries and batch queries with multiple vectors, as well as content-based search.

Parameters

Passing a Float32Array as queryVectors uses an optimized binary transfer format for better performance. When using Float32Array, the dimension parameter is required so the SDK can correctly reshape the flat array into individual query vectors.
include defaults differ between endpoints: query returns [] (only id) by default, while get returns ["vector", "contents", "metadata"].

Returns

Promise<QueryResponse>: A Promise that resolves to search results. The response format depends on the query type:
  • Single vector query: results is a flat array of QueryResultItem[]
  • Batch query: results is a nested array of QueryResultItem[][] (one array per input vector)

Exceptions

  • Throws if the API request fails due to network connectivity issues.
  • Throws if authentication fails (invalid API key).
  • Throws if the encryption key is invalid for the specified index.
  • Throws if there are internal server errors during the search.
  • Throws if neither queryVectors nor queryContents is provided.
  • Throws if vector dimensions don’t match the index configuration.
  • Throws if parameter values are out of valid ranges.
  • Throws if the include parameter contains invalid field names.

Example Usage

Basic Single Vector Query

Advanced Single Query with Filters

Batch Vector Query

Complex Metadata Filtering

Response Format

Single Query Response

Batch Query Response