/vectors/{collection}/searchSearch Vectors
Search vectors. (Data, Queries & Vectors) POST /@:projectSlug/vectors/{collection}/search.
| collection * | path | The derived collection's name. It starts with |
| projectSlug * | path | The project's slug: the path segment after It is unique within the org. |
| queryVector * | number[] | The query embedding. Its dimension must match the collection's (400 |
| topK | integer | The most results to return. Default 10. |
| minScore | number | Drop results whose No threshold when omitted. |
| metric | "cosine" | "euclidean" | "dot" | How similarity is measured and scored. Default |
| filters | object | Equality filters; every one must match. Keys are Values are strings, numbers or booleans, compared by their text form (so |
| HTTP | K9O Code | Description |
|---|---|---|
| 200 | Success | |
| 400 | K9O_INVALID_FIELD_VALUE | The project identifier in the request path is not valid. |
| 400 | K9O_INVALID_FIELD_VALUE | Vector search only targets a '_'-prefixed derived collection; use the query-builder vectorSearch() for a regular collection. |
| 400 | K9O_INVALID_FIELD_VALUE | The filters object referenced an unsupported path; only id, contentHash, source.<key>, and metadata.<key> are allowed. |
| 400 | K9O_INVALID_VECTOR_DIMENSION | The query vector's dimension does not match the dimension stored for this collection. |
| 404 | K9O_COLLECTION_NOT_FOUND | This derived vector collection has never been upserted into, so there is nothing to search. |
| data * | object | The search results. |
| results * | object[] | The closest chunks, most similar first (ties broken by id), at most Empty when nothing matches. |
| id * | string | The chunk's id. |
| score * | any | Similarity to the query, higher is closer. Null when the similarity is undefined: a |
| One of: number | ||
| or: null | ||
| _source * | object | The |
| handle * | string | The source handle sent on upsert. |
| chunkIndex * | integer | The chunk's position within its source. |
| contentHash * | any | A keyed hash of the chunk's It is the same for the same text in the same collection, so a caller can skip re-embedding a chunk whose hash is unchanged, and it can't be compared across collections or projects. Null when the chunk has no Filterable as |
| One of: string | ||
| or: null | ||
| text * | any | The chunk's source text (decrypted for a per-subject chunk), or null when none was sent. |
| One of: string | ||
| or: null | ||
| metadata * | object | The chunk's |
| model * | any |
Normally the embedding model's name (a string); the gateway returns whatever value was stored. |
| chunk * | any |
|
| One of: integer | ||
| or: null | ||
| collection * | string | The derived collection searched. |
| meta * | any | Request metadata: request id, trace id, timing and cost. |
// const k9o = new K9o({ orgSlug: 'playground', projectSlug: 'storefront', apiKey: 'k9o_…' })
const { data } = await k9o.vectors.nearest('<collection>', {})Showing example in TypeScript
{
"queryVector": [
0
],
"topK": 0,
"minScore": 0,
"metric": "cosine"
}{
"data": {
"results": [
{
"id": "string",
"score": 0,
"_source": {
"handle": "string",
"chunkIndex": 0
},
"contentHash": "string",
"text": "string",
"chunk": 0
}
],
"collection": "string"
}
}