Database endpoints
Search with the query DSL
Run a structured full-text query and receive ranked document IDs and a match count.
POST /v1/tenants/{tenant}/fts/{table}/_search
- Describe the text queryChoose clauses, sorting and result limits.
- Search the indexed fieldsEvaluate matching documents and rank hits.
- Use IDs and scoresRead the match count under your counting options.
Before you start
Use your database bearer token.
Index documents in the target field first. The examples search demo_docs/body.
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
- table is optional and must equal the URL table if sent.
- top_k defaults to 10 and may not exceed the server hit ceiling (default 10,000).
- search_after requires a non-empty sort.
- doc_values_field names the field whose stored facet values back numeric_range / function_score clauses and sorts.
- A non-null filter_expr key answers 501.
- Unknown top-level keys are ignored (body is not strictly checked).
| Field | Type | Required | Description |
|---|---|---|---|
default_field | string | Optional | — |
doc_values_field | string | Optional | — |
exact_total | boolean | Optional | — |
min_score | number | Optional | — |
params | object | Optional | BM25 tunables; both optional. |
Fields in params
| Field | Type | Required |
|---|---|---|
b | number | Optional |
k1 | number | Optional |
| Field | Type | Required | Description |
|---|---|---|---|
query | any JSON | Required | — |
search_after | object | Optional | values holds one JSON scalar per sort key (any scalar type; null means missing) and must match the sort length. doc_id is the tiebreak of the last hit seen. |
Fields in search_after
| Field | Type | Required |
|---|---|---|
doc_id | string | Optional |
values | any JSON[] | Required |
Fields in values
| Field | Type | Required |
|---|---|---|
values | any JSON | Optional |
| Field | Type | Required |
|---|---|---|
sort | object[] | Optional |
Fields in sort
| Field | Type | Required |
|---|---|---|
ascending | boolean | Required |
field | string | Required |
missing | any JSON | Optional |
mode | string | Optional |
role | string | Required |
truncate | boolean | Optional |
| Field | Type | Required |
|---|---|---|
table | string | Optional |
top_k | integer | Optional |
total_ceiling | integer | Optional |
unindexed_fields_are_empty | boolean | Optional |
universe_field | string | Optional |
Read the result
hits contains document IDs and relevance scores, and total reports the match count under the requested counting options. Fetch original records separately when your application needs their contents.
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. |
| 408 | Reduce query work or adjust the timeout. |
| 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. |
| 499 | The client cancelled the request. |
| 500 | Check the outcome before retrying a write. |
| 501 | Check deployment support for this operation. |
| 503 | Honor Retry-After when present; check write outcomes. |