OriginChainDB
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

Turn a structured text query into matchesFetch source records separately when you need their contents.
  1. Describe the text queryChoose clauses, sorting and result limits.
  2. Search the indexed fieldsEvaluate matching documents and rank hits.
  3. Use IDs and scoresRead the match count under your counting options.

Before you start

Use your database bearer token.

Connection setup

Index documents in the target field first. The examples search demo_docs/body.

Path parameters

FieldTypeRequired
tenantstringRequired
tablestringRequired

Headers

FieldTypeRequiredDescription
x-oc-db-userstringOptionalActing database user (role, grant and row-policy checks). Send with x-oc-db-key.
x-oc-db-keystringOptionalAPI 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).
FieldTypeRequiredDescription
default_fieldstringOptional—
doc_values_fieldstringOptional—
exact_totalbooleanOptional—
min_scorenumberOptional—
paramsobjectOptionalBM25 tunables; both optional.
Fields in params
FieldTypeRequired
bnumberOptional
k1numberOptional
FieldTypeRequiredDescription
queryany JSONRequired—
search_afterobjectOptionalvalues 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
FieldTypeRequired
doc_idstringOptional
valuesany JSON[]Required
Fields in values
FieldTypeRequired
valuesany JSONOptional
FieldTypeRequired
sortobject[]Optional
Fields in sort
FieldTypeRequired
ascendingbooleanRequired
fieldstringRequired
missingany JSONOptional
modestringOptional
rolestringRequired
truncatebooleanOptional
FieldTypeRequired
tablestringOptional
top_kintegerOptional
total_ceilingintegerOptional
unindexed_fields_are_emptybooleanOptional
universe_fieldstringOptional

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
StatusWhat to do
200OK
400Correct the request before retrying.
401Check the credential and Authorization header.
402Check feature access or available credits.
403Check tenant access, roles and permissions.
404Check the resource ID and API route.
408Reduce query work or adjust the timeout.
413Split or reduce the request body.
415Send the required Content-Type.
422Correct the values or unsupported combination.
429Honor Retry-After when present; back off.
499The client cancelled the request.
500Check the outcome before retrying a write.
501Check deployment support for this operation.
503Honor Retry-After when present; check write outcomes.
© 2026 Silicoyn Technologies Pvt Ltd