Database endpoints
Index a document
Indexes the text of one document for full-text search on a table field.
POST /v1/tenants/{tenant}/fts/{table}/{field}
- Choose a document IDReuse the source record's identifier.
- Index its textSelect the table field and analyzer.
- Find it through text searchUse the matching ID to reopen the source.
Before you start
Use your database bearer token.
Choose the table and text field to index. The example indexes document p1 under demo_docs/body.
Path parameters
| Field | Type | Required |
|---|---|---|
tenant | string | Required |
table | string | Required |
field | 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
- The document key is `doc_id`.
- `analyzer` is a string ("keyword", "whitespace") or an object such as {"language": "english"};
- absent uses the default analyzer.
- `values` indexes each string as one exact token instead of analysing `text` (`text` is still required).
- Success is 201 with an empty body.
| Field | Type | Required |
|---|---|---|
analyzer | any JSON | Optional |
doc_id | string | Required |
text | string | Required |
values | string[] | Optional |
Fields in values
| Field | Type | Required |
|---|---|---|
values | string | Optional |
Read the result
A successful write returns 201 with an empty body. Do not attempt to decode JSON from it. Use the same doc_id when relating the search result to your source record.
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. |
| 502 | Check service availability and the write outcome. |
| 503 | Honor Retry-After when present; check write outcomes. |