Skip to main content
query_binary is the high-throughput query path. Query vectors are sent as base64-encoded binary instead of JSON arrays, which is significantly faster for large batch queries.

Parameters

include defaults differ between endpoints: query_binary returns [] (only id) by default, while get returns ["vector", "contents", "metadata"].

Returns

  • Single query (1D query_vectors): List[Dict] — one result dict per neighbor.
  • Batch query (2D query_vectors): List[List[Dict]] — one inner list per query vector.
Each result dict contains id plus whichever of distance, metadata, vector were requested via include.

Exceptions

  • TypeError: query_vectors is not a numpy array.
  • ValueError: query_vectors.ndim is not 1 or 2, or the server returns an error.

Example Usage

Single query

Batch query

For ad-hoc queries and most application code, prefer query() — it accepts either lists or numpy arrays and automatically routes to the binary path when numpy is supplied. Call query_binary directly only when you want to bypass the routing logic.