Database endpoints
Store a sparse vector
Store a sparse vector's indices, values and dimension, with optional metadata.
POST /v1/tenants/{tenant}/vector/{table}/put_sparse
- Choose the sparse positionsList only the dimensions carrying values.
- Pair positions with valuesKeep both arrays the same length.
- Save the sparse vectorSupply its ID, dimension and optional metadata.
Before you start
Use your database bearer token.
Match the lengths of indices and values, and keep every index below dim. The example uses dimension 3.
Path parameters
| Field | Type | Required |
|---|---|---|
tenant | string | Required |
table | string | Required |
Headers
| Field | Type | Required | Description |
|---|---|---|---|
x-oc-db-user | string | Optional | Acting database user (role, grant and row-policy checks). Send with x-oc-db-key. |
x-oc-db-key | string | Optional | API key of the x-oc-db-user user. |
Request body
application/json
Limits and accepted values
- `indices` and `values` must be the same length, every index must be below `dim`, and every value finite;
- indices need not be sorted (duplicates are summed).
- Success is 201 with an empty body.
| Field | Type | Required |
|---|---|---|
dim | integer | Required |
id | string | Required |
indices | integer[] | Required |
Fields in indices
| Field | Type | Required |
|---|---|---|
indices | integer | Optional |
| Field | Type | Required |
|---|---|---|
metadata | object | Optional |
values | number[] | Required |
Fields in values
| Field | Type | Required |
|---|---|---|
values | number | Optional |
Read the result
Success is 201 with an empty body. Each entry pairs an indices position with the value at the same array position; omitted dimensions are not sent as dense zeros.
Response statuses
HTTP status reference
| Status | What to do |
|---|---|
| 201 | Created |
| 400 | Correct the request before retrying. |
| 401 | Check the credential and Authorization header. |
| 402 | Check feature access or available credits. |
| 403 | Check tenant access, roles and permissions. |
| 409 | Resolve the conflict before retrying. |
| 413 | Split or reduce the request body. |
| 415 | Send the required Content-Type. |
| 422 | Correct the values or unsupported combination. |
| 429 | Honor Retry-After when present; back off. |
| 500 | Check the outcome before retrying a write. |
| 503 | Honor Retry-After when present; check write outcomes. |