All Products
Search
Document Center

OpenSearch:Query pagination - config clause

Last Updated:Oct 14, 2026

The config clause specifies the starting position of query results, the number and format of returned results, and the number of documents that participate in fine ranking.

Syntax

Parameter

Type

Required

Valid values

Default value

Description

start

int

No

[0, 5000]

0

Return search results starting from the document specified by start.

hit

int

No

[0, 500]

10

The maximum number of documents to return.

format

string

No

json

The format of returned documents. Valid values are json and fulljson. Compared with json, fulljson includes additional fields, such as variableValue and sortExprValues.

rerank_size

int

No

[0, 2000]

200

The number of documents from a single list that participate in fine ranking.

total_rank_size

int

No

-

-

The number of documents that participate in coarse ranking.

default_operator

string

No

'AND' or 'OR'

AND

The default query operator for this query. This parameter is supported only for dedicated instances.

Notes

  1. The config clause is optional.

  2. Separate parameter pairs with commas (,).

  3. Separate the key and value within a parameter pair with a colon (:).

  4. The sum of start and hit cannot exceed 5,000. If it does, the query fails and returns no results. To paginate more than 5,000 documents, use the scroll method to batch export the documents, and then implement pagination in your application.

  5. The default_operator parameter is supported only for dedicated instances.

  6. Configure total_rank_size in the SDK as follows. Java SDK: config.addToCustomConfig("total_rank_size:200000");. PHP SDK: $params->setCustomConfig('total_rank_size', 200000);.

  7. To view ranking details in code:

    Add format:fulljson to the config clause.

    In the response, sortExprValues contains the document score:

    "sortExprValues": [
        "10000.0399786383"
    ]

    sortExprValues is an array that contains the values of the fields in the sort clause. For example:

    sort=-price;-RANK

    In this example, sortExprValues contains [price, document score]. If sort is not specified, the value defaults to the document score.

Examples

  1. Pagination: Retrieve 20 results per page. The following examples retrieve the first and second pages.

    # First page
    config=start:0, hit:20, format:xml   
    # Second page
    config=start:20, hit:20, format:xml
  2. Set the number of documents for fine ranking to 1,000.

    config=start:0, hit:20, rerank_size:1000
  3. Reduce the number of documents to retrieve.

    config=start:0, hit:20, total_rank_size:100