Search
Queries data by using search indexes.
Request syntax
message SearchRequest {
optional string table_name = 1;
optional string index_name = 2;
optional ColumnsToGet columns_to_get = 3;
optional bytes search_query = 4;
repeated bytes routing_values = 5;
optional int32 timeout_ms = 6;
}
|
Parameter |
Type |
Required |
Description |
|
table_name |
string |
Yes |
The name of the data table. |
|
index_name |
string |
Yes |
The name of the search index. |
|
columns_to_get |
No |
The columns that you want to return. |
|
|
search_query |
bytes |
Yes |
The query configuration. The value must be encoded in protobuf. For more information about the configuration items, see SearchQuery. |
|
routing_values |
bytes |
No |
The routing key. |
|
timeout_ms |
int32 |
No |
The timeout period of the query. Unit: milliseconds. |
Response syntax
message SearchResponse {
optional int64 total_hits = 1;
repeated bytes rows = 2;
repeated SearchHit search_hits = 5;
optional bool is_all_succeeded = 3;
optional bytes next_token = 6;
optional bytes aggs = 7;
optional bytes group_bys = 8;
optional ConsumedCapacity consumed = 9;
optional ConsumedCapacity reserved_consumed = 10;
}
|
Parameter |
Type |
Description |
|
total_hits |
int64 |
The total number of matched rows. |
|
rows |
bytes |
The information about the rows. The value is encoded in PlainBuffer. For more information, see PlainBuffer. |
|
search_hits |
The returned matched rows. The return value exists only when you use the query summary and highlight feature or the KNN vector query feature. |
|
|
is_all_succeeded |
bool |
Indicates whether the query is successful. |
|
next_token |
bytes |
The position from which the next data read starts. If all data rows that meet the condition are returned, the value of this parameter is empty. |
|
aggs |
bytes |
The aggregation operation performed on the data rows, such as calculating the maximum value, minimum value, average value, or row count. The aggregation results are encoded in protobuf. |
|
group_bys |
bytes |
Groups the data rows by field value or range. The grouping results are encoded in protobuf. |
|
consumed |
The number of metered capacity units consumed by the operation. |
|
|
reserved_consumed |
The number of reserved capacity units consumed by the operation. |