/data/{collection}/searchSearch Records by Vector
The record list read with its query in the body, for a vector too long for a URL.
The body is:
{ vectorSearch: { column, vector, metric?, limit? }, filter?, select?, order?, limit?, cursor?, count?, or? }Runs exactly what GET /data/{collection} runs for the same parameters (the same read access, row policies and field reveal), so the rows and their order are the same, nearest first.
A vectorSearch.column the collection does not have answers K9O_INVALID_FIELD_VALUE (400).
Exempt from read-only suspension, like the GET.
The same filter bounds, time limit (K9O_QUERY_TIMEOUT, 504) and protected-column equality rule apply.
| collection * | path | The collection's name. |
| projectSlug * | path | The project's slug: the path segment after It is unique within the org. |
| vectorSearch * | object | The nearest-neighbour search to run. |
| column * | string | The vector column to search, as named in the collection. It must be a vector column of the collection. |
| vector * | number[] | The query vector: finite numbers. Its length must equal the column's dimension. |
| metric | "cosine" | "euclidean" | "dot" | How similarity is measured. Default |
| limit | integer | The most nearest records to return, 1 to 1000. |
| filter | object | Narrows the records searched. Each key is a column name and each value is the same A key that is a list parameter name, or |
| select | string | The columns to return, as in the list endpoint's |
| order | string | The sort order, as in the list endpoint's |
| limit | any | The page size, as in the list endpoint's A number or a numeric string. |
| One of: integer | ||
| or: string | ||
| cursor | string | A |
| count | "none" | "exact" | "estimated" | Whether to count the matching records, as in the list endpoint's Default |
| or | string | An OR group of filters, as in the list endpoint's |
| HTTP | K9O Code | Description |
|---|---|---|
| 200 | Success | |
| 400 | K9O_INVALID_FIELD_VALUE | The body is not `{ vectorSearch: { column, vector, metric?, limit? }, filter?, select?, order?, limit?, cursor?, count?, or? }`. Any of these cases applies: - An unknown field, a non-numeric vector, an invalid column, metric or limit, or a filter key that is not a column. - A filter, select or order expression is invalid. - The vectorSearch column does not exist on the collection. - The vectorSearch column is not a vector column (reason not_a_vector_column). - The vectorSearch column holds a different dimension than the query vector (reason dimension_mismatch). |
| 400 | K9O_INVALID_FILTER | A filter operand is past its cap: a `match`, `like` or `ilike` pattern over 256 characters or a `jsonPath` over 512 (`context.reason: "operand_too_long"`), or an `in` / `notIn` list over 1,000 items (`too_many_items`). `context.column`, `context.op` and `context.max` say which. |
| 400 | K9O_ENCRYPTED_COLUMN_OPERATION_UNSUPPORTED | The operation is not supported on a protected column: only `eq` and `in` on a searchable one, and on one that needs a reveal purpose only in a read that reveals it (`context.reason: "reveal_required"`). |
| 401 | K9O_SESSION_EXPIRED | The caller's session has expired. |
| 401 | K9O_INVALID_CREDENTIALS | The caller is not authenticated. |
| 403 | K9O_ACCESS_DENIED | The caller has no read access to this collection, the same as GET /data/{collection}. |
| 403 | K9O_EXTENSION_PERMISSION_DENIED | An extension caller lacks (documents, read, <collection>), the grant GET /data/{collection} requires. |
| 404 | K9O_COLLECTION_NOT_FOUND | No such collection in this project. |
| 504 | K9O_QUERY_TIMEOUT | The read ran past its time limit and returned nothing. `context.timeoutSeconds` gives the limit; narrow the filter or simplify a pattern. |
| data * | any | A page of records; a single record with |
| One of: object[] | ||
| or: object | ||
| or: object | ||
| meta * | object | Request metadata (cost, timing, request and trace ids), plus the pagination cursor on a list answer. |
| cursor | object | Pagination. Present on a list answer; absent with |
| next * | any | Opaque cursor for the next page; pass it back as Null on the last page, and always null with |
| One of: string | ||
| or: null | ||
| totalCount | any | The filtered row count when Absent with |
| One of: integer | ||
| or: null | ||
| countMethod | "none" | "exact" | "estimated" | The Absent with |
| warnings | object[] | Present only when a warning applies. |
| code * | string | A warning code. This read adds |
| message * | string | A readable explanation. |
curl -X POST 'https://<org>.api-<region>.k9o.io/@storefront/data/products/search' \
-H 'Authorization: Bearer $K9O_TOKEN' \
-H 'Content-Type: application/json' \
-d '{}'Showing example in cURL
{
"vectorSearch": {
"column": "string",
"vector": [
0
],
"metric": "cosine",
"limit": 0
},
"select": "string",
"order": "string",
"limit": 0,
"cursor": "string",
"count": "none",
"or": "string"
}{
"data": [],
"meta": {
"cursor": {
"next": "string",
"totalCount": 0,
"countMethod": "none"
},
"warnings": [
{
"code": "string",
"message": "string"
}
]
}
}