Search indexes in Tablestore SDK for Java support basic queries, Boolean query, sorting and paging, aggregation, full-text search, and k-nearest neighbor (KNN) vector query.
Basic queries
The following table lists the basic query types supported by search indexes.
|
Query type |
Description |
|
This query matches all rows in a table to query the total number of rows in the table or return multiple random rows. |
|
|
This query uses exact matches to retrieve data from a data table. A term query is similar to a query based on string matching. |
|
|
This query allows you to specify multiple keywords to search for the rows that match at least one of the keywords. A row of data is returned if the column value matches at least one of the keywords. Terms queries can be used in the same manner as the IN operator in SQL statements. |
|
|
This query retrieves data that contains the specified prefix from a data table. |
|
|
This query retrieves data that contains the specified suffix from a data table. |
|
|
This query retrieves data that matches a string containing wildcard characters. |
|
|
This query retrieves data that falls within the specified range from a table. |
|
|
This query is also called NULL query or NULL-value query, which is used in sparse data to determine whether a column of a row exists. |
|
|
This query collapses the result set based on a specific column to display data of the specified type only once in the returned results, ensuring the diversity of the result types. |
|
|
Geo queries are classified into the following types: geo-distance query, geo-bounding box query, and geo-polygon query.
|
|
|
This query retrieves the data in the child rows of Nested fields. |
Boolean query
A Boolean query combines multiple subqueries to retrieve rows that match 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. When a large number of rows match, paginate results by configuring the limit and offset parameters or by using tokens. For more information, see Perform sorting and paging.
Aggregation
Aggregation operations return statistics such as the minimum value, maximum value, 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 matched terms in the returned 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.