Database endpoints
Suggest completions
Find completions and spelling or phrase corrections using an indexed field's terms.
POST /v1/tenants/{tenant}/fts/{table}/_suggest
- Choose a suggestion typeComplete a prefix or correct terms or phrases.
- Use the field's indexed termsSupply the prefix or query text for that type.
- Read the suggested candidatesUse frequency and scan details to interpret results.
Before you start
Use your database bearer token.
Index text in the target field before asking for term or prefix suggestions.
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
- Tagged by kind: completion | term | phrase.
- completion requires prefix and accepts size, order (frequency | lexicographic), max_scan.
- term requires text and accepts size, max_edits, mode (missing | popular | always), min_word_length.
- phrase requires text and accepts size, max_edits, candidates_per_term, confidence (default 1.0), min_word_length.
- A missing or unknown kind is rejected by body parsing.
| Field | Type | Required |
|---|---|---|
candidates_per_term | integer | Optional |
confidence | number | Optional |
field | string | Required |
kind | string | Required |
max_edits | integer | Optional |
max_scan | integer | Optional |
min_word_length | integer | Optional |
mode | string | Optional |
order | string | Optional |
prefix | string | Optional |
size | integer | Optional |
text | string | Optional |
Read the result
The result shape follows kind: completion returns completions, while term and phrase requests return their own suggestions. Frequency and scan fields help you interpret how candidates were selected.
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. |