Search indexes in Tablestore SDK for Python support basic queries, Boolean query, sorting and paging, aggregation, full-text search, and k-nearest neighbor (KNN) vector query.
Basic queries
The following table describes the basic queries supported by search indexes.
|
Query type |
Description |
|
Matches all rows. Use to get the total row count or return random rows. |
|
|
Retrieves data by exact match on a column value, similar to string matching. |
|
|
Matches rows where a column value equals any of the specified keywords. Equivalent to the SQL IN operator. |
|
|
Matches rows where a column value starts with the specified prefix. |
|
|
Matches rows where a column value falls within a specified range. |
|
|
Matches rows by using wildcard characters in the search string. |
|
|
Checks whether a specific column exists in a row. Also known as a NULL query or NULL-value query. Useful for sparse data. |
|
|
Deduplicates results by a specified column so that each distinct value appears only once, ensuring diversity in the result set. |
|
|
Queries rows by geographic location. Includes three subtypes:
|
|
|
Queries child rows of nested fields. |
Boolean query
A Boolean query retrieves data based on a combination of subqueries and returns the rows that meet the specified conditions. For more information, see Boolean query.
Sorting and paging
You can predefine a sorting method when you create a search index, or specify one at query time. For large result sets, use the limit and offset parameters or tokens to page through results. For more information, see Sorting and paging.
Aggregation
Aggregation operations return statistics such as minimum, maximum, sum, average, count, distinct count, and percentiles. You can also group results by field value, range, geographical location, filter, histogram, or date histogram, and run nested aggregations within each group. For more information, see Aggregation.
Full-text search
Full-text search finds rows that contain specified query strings. You can configure highlight parameters to highlight matching terms in the results. For more information, see Full-text search.
KNN vector query
KNN vector query performs an approximate nearest neighbor search to find the most similar data items to a given vector in a large-scale dataset. For more information, see KNN vector query.