All Products
Search
Document Center

Tablestore:Search

Last Updated:May 13, 2024

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

ColumnsToGet

No

The columns 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 a request. Unit: milliseconds.

Response syntax

message SearchResponse {
    optional int64 total_hits = 1;
    repeated bytes rows = 2;
    optional bool is_all_succeeded = 3;
    optional bytes next_token = 6;
    optional bytes aggs = 7;
    optional bytes group_bys = 8;
}

Parameter

Type

Required

Description

total_hits

int64

No

The total number of matched rows.

rows

bytes

No

The information about the rows. The value is encoded in PlainBuffer. For more information, see PlainBuffer.

is_all_succeeded

bool

No

Indicates whether the query is successful.

next_token

bytes

No

The position from which the next data read starts.

If all data rows that meet the condition are returned, the return value is empty.

aggs

bytes

No

The aggregation operation performed on the data rows, such as calculating the maximum value, minimum value, average value, or row count.

group_bys

bytes

No

Indicates how the data rows are grouped, such as group by field value or group by range. The value is encoded in protobuf.

Use Tablestore SDKs