Database endpoints
Search an index
Search a vector namespace with dense, sparse, lexical or hybrid ranking and an optional metadata filter.
POST /v1/tenants/{tenant}/vector-indexes/{index_id}/search
- Choose search inputsSupply dense, sparse, lexical or combined query evidence.
- Rank within a namespaceApply the requested filter and fusion settings.
- Inspect hits and completenessRead ranking_method and components before interpreting the result.
Before you start
Use your database bearer token.
Use the index_id returned when the index was created. Insert records into the target namespace before searching it.
Path parameters
| Field | Type | Required |
|---|---|---|
tenant | string | Required |
index_id | 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
- mode: semantic, lexical, hybrid or dense_with_text_filter.
- k is 1 up to the engine's limit (default 10,000).
- include_components defaults to true, the other include_* to false.
- Not yet served (501): expected_generation, timeout_ms, text_fields, a projection on a plan with a lexical leg, fusion weighted_sum and mode dense_with_text_filter.
- Unknown fields at any depth answer 400 unknown_request_field.
| Field | Type | Required | Description |
|---|---|---|---|
dense | object | Optional | Query by vector or by the id of a stored record. quality: exact, fast or high_recall (default). |
Fields in dense
| Field | Type | Required |
|---|---|---|
candidates | integer | Optional |
quality | string | Optional |
record_id | string | Optional |
vector | number[] | Optional |
Fields in vector
| Field | Type | Required |
|---|---|---|
vector | number | Optional |
| Field | Type | Required | Description |
|---|---|---|---|
expected_generation | string | Optional | — |
filter | object | Optional | — |
filter_expr | object | Optional | — |
fusion | object | Optional | method: rrf (optional rrf_k, default 60) or weighted_sum (weights required; currently answers 501). |
Fields in fusion
| Field | Type | Required |
|---|---|---|
method | string | Required |
rrf_k | integer | Optional |
weights | object | Optional |
Fields in weights
| Field | Type | Required |
|---|---|---|
dense | number | Required |
sparse | number | Required |
| Field | Type | Required | Description |
|---|---|---|---|
include_components | boolean | Optional | — |
include_metadata | boolean | Optional | — |
include_sparse | boolean | Optional | — |
include_values | boolean | Optional | — |
k | integer | Required | — |
lexical | object | Optional | match: terms (default) or phrase. query is at most 4,096 bytes and must not be blank. |
Fields in lexical
| Field | Type | Required |
|---|---|---|
candidates | integer | Optional |
field | string | Required |
match | string | Optional |
query | string | Required |
| Field | Type | Required |
|---|---|---|
metadata_fields | string[] | Optional |
Fields in metadata_fields
| Field | Type | Required |
|---|---|---|
metadata_fields | string | Optional |
| Field | Type | Required | Description |
|---|---|---|---|
mode | string | Required | — |
namespace | string | Required | — |
require_complete | boolean | Optional | — |
sparse | object | Optional | scorer: cosine or dot. At most 1,024 non-zero entries. |
Fields in sparse
| Field | Type | Required |
|---|---|---|
candidates | integer | Optional |
indices | integer[] | Required |
Fields in indices
| Field | Type | Required |
|---|---|---|
indices | integer | Optional |
| Field | Type | Required |
|---|---|---|
scorer | string | Optional |
values | number[] | Required |
Fields in values
| Field | Type | Required |
|---|---|---|
values | number | Optional |
| Field | Type | Required |
|---|---|---|
text_fields | string[] | Optional |
Fields in text_fields
| Field | Type | Required |
|---|---|---|
text_fields | string | Optional |
| Field | Type | Required |
|---|---|---|
timeout_ms | integer | Optional |
Read the result
hits contains ranked records; ranking_method and per-leg components explain the scores. Check completeness before interpreting an underfilled answer. A hybrid score is not the same quantity as a raw dense-vector score.
Response statuses
HTTP status reference
| Status | What to do |
|---|---|
| 200 | OK |
| 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. |
| 404 | Check the resource ID and API route. |
| 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. |
| 501 | Check deployment support for this operation. |
| 503 | Honor Retry-After when present; check write outcomes. |