All Products
Search
Document Center

Tablestore:Timeline management

Last Updated:Aug 03, 2023

You can call operations such as fuzzy query, Boolean query, and Flush operations to manage Timeline data.

Search

The query operations work on the basis of the Search Index feature. Only the TimelineStore that has IndexSchema configured supports the query operations. An index can be of the LONG, DOUBLE, BOOLEAN, KEYWORD, GEO_POINT, or TEXT type. The index attributes include Index, Store, Array, and Token, and have the same descriptions as those of the Search Index feature. For more information, see Data type mappings.

You can call the Search operation to use fuzzy query and Boolean query. To use fuzzy search, you need to set the index type of the field to TEXT type and specify a token type for the field. For more information, see Tokenization.

/**
 * Search timeline by SearchParameter.
 * */
SearchParameter searchParameter = new SearchParameter(
        field("text").equals("fieldValue")
);
timelineStore.search(searchParameter);

/**
 * Search timeline by SearchQuery.
 * */
TermQuery query = new TermQuery();
query.setFieldName("text");
query.setTerm(ColumnValue.fromString("fieldValue"));
SearchQuery searchQuery = new SearchQuery().setQuery(query).setLimit(10);
timelineStore.search(searchQuery);

Flush

The BatchStore operation works on the basis of the DefaultTableStoreWriter class in Tablestore SDKs. You can call the Flush operation to trigger the process of sending undelivered messages in the Buffer to Tablestore and wait until Tablestore stores all these messages.

/**
 * Flush messages in buffer, and wait until all messages are stored.
 * */
timelineStore.flush();