All Products
Search
Document Center

config clause

Last Updated: Sep 09, 2021

Clause description

The config clause is used to specify configurations such as the offset, number of documents, and data format of return results, and the number of documents to be sorted by a fine sort expression.

Parameters

Parameter

Type

Required

Valid value

Default value

Description

start

int

No

[0, 5000]

0

The ordinal number of the first document to be returned in search results.

hit

int

No

[0, 500]

10

The maximum number of documents in each result set.

format

string

No

json

The data format of return results. Supported formats are JSON and fullJSON. Compared with the JSON format, the fullJSON format supports extra fields such as variableValue and sortExprValues.

rerank_size

int

No

[0, 2000]

200

The number of documents to be sorted by a fine sort expression.

total_rank_size

int

No

-

-

The maximum number of documents that can be retrieved.

Usage notes

  1. The config clause is optional.

  2. Separate the key-value pairs of parameters with commas (,).

  3. Separate the key and value of each parameter with a colon (:).

  4. Make sure that the sum of the values of the start and hit parameters does not exceed 5,000. Otherwise, an error occurs and no results are returned.
  5. The total_rank_size parameter is specified in different formats in OpenSearch SDKs for different languages. In OpenSearch SDK for Java, specify this parameter in the following format: config.addToCustomConfig("total_rank_size:200000");. In OpenSearch SDK for PHP, specify this parameter in the following format: $params->setCustomConfig('total_rank_size', 200000);.

Examples

  1. Use the config clause to configure paging. In this example, each page of return results displays 20 documents.

    # The config clause for the first page.
    config=start:0, hit:20, format:xml   
    # The config clause for the second page.
    config=start:20, hit:20, format:xml
  2. Set the number of documents to be sorted by a fine sort expression to 1000.

    config=start:0, hit:20, rerank_size:1000
  3. Set the maximum number of documents to be retrieved to 100.

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