A term query (TermQuery) finds data in a table by matching a specified value exactly, similar to string matching.
Usage notes
-
For non-text field types like
KeywordandInteger, the field value must exactly match the query term. -
Avoid using a term query on
Textfields, as their tokenization is unpredictable and may change over time. A term query on aTextfield checks if any token produced by the analyzer exactly matches the query term. The query term itself is not tokenized. To match an entire, un-tokenized value, use a virtual column to map the field to theKeywordtype and then run the query. For example, if aTextfield with the value "tablestore is cool" is tokenized into "tablestore", "is", and "cool", a query for "tablestore", "is", or "cool" will return a match.
Procedure
Go to the Index Management tab.
Log on to the Table Store console.
In the top navigation bar, select a resource group and a region.
On the Overview page, click the instance name or click Instance Management in the Actions column.
On the Instance Details tab, in the Data Table List tab, click the data table name or click Index Management in the Actions column.
On the Index Management tab, find the target Search Index and click Search in the Actions column.
-
In the Search dialog box, configure the query.
By default, all columns are returned. To return specific columns, turn off Retrieve All Columns and enter the column names, separated by commas.
NoteBy default, Table Store returns the primary key columns of the data table.
Select a logical operator: And, Or, or Not.
If you select And, the query returns data that meets all specified conditions. If you select Or, the query returns data that meets at least one of the specified conditions. If you select Not, the query returns data that does not meet the specified conditions.
-
Select an index field and click Add.
-
Set the query type of the index field to Term Query (TermQuery) and enter the value to search for.
By default, sorting is disabled. To sort the results by a specific field, turn on Enable Sorting, add the sort field, and configure the sort order.
By default, aggregation is disabled. To perform statistical aggregation on a specific field, turn on Enable Aggregation, add the field for aggregation, and configure the aggregation settings.
Click OK.
The query results are displayed on the Index Management tab.
Development integration
You can use an SDK or a command-line tool to perform a term query.
Billing
Querying data by using a Search Index consumes read throughput. For more information, see Search Index metering and billing.
FAQ
Related documents
Search Index supports various query types for multi-dimensional data queries, including term query, terms query, match all query, match query, phrase match query, range query, prefix query, suffix query, wildcard query, token-based wildcard query, boolean query, geo query, nested query, vector search, and exists query.
When you query data, you can sort and paginate the result set or perform collapsing (deduplication).
For data analysis, such as finding the maximum or minimum value, calculating a sum, or counting rows, you can use the statistical aggregation or SQL query features.
To quickly export data regardless of the result set order, you can use the Parallel Scan feature.