All Products
Search
Document Center

OpenSearch:config clause

Last Updated:Mar 31, 2026

The config clause is a required part of every query statement. Use it to control query behavior at runtime — including pagination, output format, timeouts, and ranking.

Syntax

config=key1:value1,key2:value2,...

Separate each parameter name and value with a colon (:). To set multiple parameters, chain them with commas.

Parameters

Parameters are grouped by function. For most queries, you only need the pagination and output parameters.

Pagination

ParameterDefaultDescription
start0The zero-based offset of the first document to return. The sum of start and hit must not exceed 5,000; exceeding this limit returns an error with no results.
hit10The maximum number of documents to return per result set. The sum of start and hit must not exceed 5,000; exceeding this limit returns an error with no results.

Output format

ParameterValid valuesDefaultDescription
formatjson, xmlxmlThe format of the query results.
no_summaryyes, nonoIf set to yes, only the first-phase query runs and the summary is not fetched. Use this to reduce latency when you don't need document summaries.
fetch_summary_typedocid, pk, rawpkdocidThe method used to fetch the summary. docid fetches by document ID. pk fetches by the hash value of the primary key. rawpk fetches by the original primary key value. We recommend that you use pk or rawpk.

Timeout and performance

ParameterDefaultDescription
timeout0The query timeout in milliseconds. Must be a non-negative number. When set, seek_timeout defaults to timeout × 0.7 unless you set seek_timeout explicitly.
seek_timeout0The timeout for the query seeking phase, in milliseconds. Defaults to timeout × 0.7. Set this explicitly to override the derived value.
searcher_return_hits0The number of records returned by the searcher. When set to 0, the value is determined by start and hit. Cannot exceed 5,000.
research_threshold0If the number of returned records is less than this value, the query runs again.

Default query settings

ParameterValid valuesDefaultDescription
default_indexSTRING""The default index for this query. Falls back to the index set in query_config in the cluster configuration file. An index specified in the query itself takes precedence.
default_operatorAND, OR""The default logical operator for this query. Falls back to the operator set in query_config in the cluster configuration file. An operator specified in the query takes precedence.

Deduplication and replica selection

ParameterValid valuesDefaultDescription
dedupyes, noyesWhen set to yes, duplicate documents are automatically removed from results based on the primary key. When set to no, duplicates are not removed from the result.
sourceidSTRING(none)Pins the query to a specific replica selected by the hash of this value. Users with the same sourceid value always query the same replica, which ensures they see the latest data during incremental index updates. When not set, a replica is selected randomly for each query.

Ranking and scoring

ParameterDefaultDescription
rerank_hintfalseSpecifies whether to run the second scoring (rerank) pass. Set to true to enable reranking.
rank_size0The number of documents included in the rough sort pass, or the truncation count for dynamic indexing. When set to 0, the value from the cluster configuration file is used.
rerank_size0The number of documents passed to the fine sort pass. When set to 0, the value from the cluster configuration file is used.
total_rank_size0The total number of roughly sorted documents across all partitions, or the truncation count for a dynamic index. When set to 0, the value from the cluster configuration file is used.
total_rerank_size0The total number of finely sorted documents across all partitions. When set to 0, the value from the cluster configuration file is used.
rank_trace(none)The verbosity level of front-end scoring output. Valid values: FATAL, ERROR, INFO, DEBUG, WARN, TRACE1, TRACE2, TRACE3.
actual_hits_limit0Controls whether totalhits in the response is an exact count or an estimate. If the actual number of matching documents is less than this value, the exact count is returned. If it is greater, an estimate is returned. If the actual number is 0, the estimated count is returned. Setting this to numeric_limits<uint32_t>::max() always returns the exact count.

Examples

Implement pagination

Fetch 20 documents per page. Increment start by 20 for each subsequent page.

# Page 1
config=start:0,hit:20,format:xml

# Page 2
config=start:20,hit:20,format:xml

Control fine sort size

Pass 1,000 documents to the fine sort pass:

config=start:0,hit:20,rerank_size:1000

Set query timeout

Set a 500 ms query timeout. The seeking phase will automatically use 350 ms (500 × 0.7):

config=start:0,hit:20,timeout:500

To override the seeking timeout explicitly:

config=start:0,hit:20,timeout:500,seek_timeout:400

Usage notes

  • Separate each parameter name and value with a colon (:).

  • The sum of start and hit must not exceed 5,000. Exceeding this limit returns an error with no results.