Overview
A config clause is an optional part of a query statement. You can use the config clause to configure a query. For example, you can specify the start offset, the number of returned records, the format of the query results, and the timeout period of the query.
Syntax
{
"config": {
}
}
A config clause is optional. The content of the config clause is an object. For more information about the parameters that are supported by the config clause, see the Parameters section of this topic.
Parameters
Parameter | Valid value or type | Default value | Description |
start | NUMBER | 0 | The offset value from which the system starts to return documents in the result set. |
hit | NUMBER | 10 | The maximum number of documents to return. |
format | json and xml | xml | The format of the query results. |
rank_trace | FATAL, ERROR, INFO, DEBUG, WARN, TRACE1, TRACE2, and TRACE3 | No default value | The output information about the scoring process of a document in the frontend. |
default_index | string | "" | The default index that is used in the query. The default index is the same as the index that is specified in the query_config configuration item in the cluster configuration file. If you specify an index in the query, the index specified in the query is preferentially used as the default index. Otherwise, the index that is specified in the query_config configuration item is used. |
default_operator | AND and OR | "" | The default operator that is used in the query. The default operator is the same as the operator that is specified in the query_config configuration item in the cluster configuration file. If you specify an operator in the query, the operator specified in the query is preferentially used as the default operator. Otherwise, the operator that is specified in the query_config configuration item is used. |
timeout | NUMBER | 0 | The timeout period of the query. Unit: millisecond. The value cannot be a negative number. |
seek_timeout | NUMBER | 0 | The timeout period of the query seeking phase. Unit: millisecond. Default value: 0. By default, the specified timeout period multiplied by 0.7 is used as the seeking timeout period. |
no_summary | no and yes | no | Specifies whether to perform only a phase-1 query. |
dedup | no and yes | yes | Specifies whether to automatically remove duplicates from the results based on the primary key. |
searcher_return_hits | NUMBER | 0 | The number of records to be returned by the searcher. A value of 0 specifies that the records are returned based on the values of the start and hit parameters. The value of the searcher_return_hits parameter cannot exceed 5000. |
actual_hits_limit | NUMBER | 0 | Specifies whether the value of the totalhits parameter is an actual value or an estimated value. If the actual number of returned records is smaller than the value of the actual_hits_limit parameter, the actual value is returned. If the actual number of returned records is greater than or equal to the value of the actual_hits_limit parameter, the estimated value is returned. If the actual number of returned records is 0, the estimated value is returned. If the numeric_limits<uint32_t>::max() condition is met, the actual value is returned. |
sourceid | string | No default value | The source ID based on which a replica is selected for the query. Multiple replicas are available for indexes online. If you do not specify the sourceid parameter, a replica is randomly selected for each query. When an index is incrementally updated, the updated data may not be synchronized to all replicas. As a result, the most recent query results may not be returned. After the value of the sourceid parameter is specified, a replica is selected for the query based on the hash value of the sourceid parameter. In this case, the users who use the same value of the sourceid parameter can query the latest data. The value of the sourceid parameter is of the STRING type. |
rerank_hint | BOOL | false | Specifies whether to perform the second scoring process for the query. |
rank_size | NUMBER | 0 | The number of documents that are roughly sorted or the number of documents that are truncated based on a dynamic index. If the value of this parameter is 0, the value in the configuration file is used. |
rerank_size | NUMBER | 0 | The number of documents that are finely sorted in the first scoring process. If the value of this parameter is 0, the value in the configuration file is used. |
total_rank_size | NUMBER | 0 | The sum of documents that are roughly sorted in all partitions or the number of documents that are truncated based on a dynamic index. If the value of this parameter is 0, the value in the configuration file is used. |
total_rerank_size | NUMBER | 0 | The sum of documents that are finely sorted in the first scoring process of each partition. If the value of this parameter is 0, the value in the configuration file is used. |
fetch_summary_type | docid or pk or rawpk | docid | The method that is used to obtain the summary. By default, the summary is obtained based on the document ID. You can also specify to obtain the summary based on the hash value or the original value of the primary key. We recommend that you obtain the summary based on the hash value or the original value of the primary key. |
research_threshold | NUMBER | 0 | The threshold based on which a re-search is triggered. If the number of returned records is less than the value of this parameter, the query is performed again. |
Examples
Use the config clause to configure paging. In this example, each page of the query 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":1, "hit":20, "format":"xml" } }
Set the number of documents to be sorted by a fine sort expression to 1000.
{ "config": { "start":1, "hit":20, "rerank_size":1000 } }