This topic describes the mappings between field data types in data tables and their corresponding types in search indexes. It also explains the additional properties and query features supported by different field data types.
Data type mappings
The value of a field in a search index is derived from the value of the corresponding field in the data table. The data types of these fields must match. The following table describes the mappings between field data types in search indexes and data tables.
The data types in the table must have a one-to-one mapping. Geo-point and Nested types also require specific formats. If these requirements are not met, the data is discarded as dirty data. This can cause data to exist in the table but not be found in the search index.
Field data type in search indexes | Field data type in data tables | Description |
Long | Integer | A 64-bit long integer. |
Double | Double | A 64-bit double-precision floating-point number. |
Boolean | Boolean | A Boolean value. |
Keyword | String | A string that cannot be tokenized. |
FuzzyKeyword | String | A string that supports high-performance fuzzy queries. |
Text | String | A string or text that can be tokenized. For more information, see String types. |
Date | Integer, String | The Date data type supports various custom formats for date data. |
IP | String | The IP type supports IP addresses in IPv4 and IPv6 formats. |
Geo-point | String | The coordinate information of a point. The format is |
Vector | String, Binary | The vector type. The value is a string in the format of a Float32 array. The length of the array is equal to the dimension of the field. For example, the vector string |
String | The nested type. For example, | |
JSON type | String | The JSON type. It supports the OBJECT and NESTED types. |
Field attribute support
Search index fields support additional properties, such as array, virtual column, and highlighting. The supported properties vary based on the data type. The following table lists the applicable data types and provides a description for each additional property.
Property | Applicable data types | Description |
Array | Long, Double, Boolean, Keyword, Text, Date, IP, and Geo-point | To store a series of data of the same type, set the field to the array type. When you write data, it must be in the JSON array format, such as Nested, Vector, and JSON types are arrays by nature, so you do not need to set this property. |
Virtual column | Long, Double, Keyword, FuzzyKeyword, Text, Date, IP, Geo-point, and Vector | If you want to query new fields with new types without changing the storage structure and data in Tablestore, set the field as a virtual column. |
Date format | Date | When you use the Date type, you must specify the date format. |
Tokenization | Text | To implement full-text search, configure tokenization for the field. |
Summary and highlighting | Text | To highlight hit search queries in full-text searches, enable the Summary and Highlighting feature for the field. |
Vector configuration | Vector | When you use a Vector field, you must specify the vector's measure algorithm and dimension. |
JSON type configuration | JSON | When using a JSON field, specify the JSON type. The Object and Nested types are supported. |
Query feature support
The following table describes the query features available for each data type.
"✓" indicates that the feature is supported. "×" indicates that the feature is not supported.
The match all query feature does not require you to set fields.
Query feature | Long | Double | Boolean | Keyword | FuzzyKeyword | Text | Date | IP | Geo-point | JSON Object | Nested/JSON Nested | Vector |
✓ | ✓ | ✓ | ✓ | × | × | ✓ | ✓ | × | ✓ | × | × | |
✓ | ✓ | ✓ | ✓ | × | × | ✓ | × | × | ✓ | × | × | |
✓ | ✓ | ✓ | ✓ | × | × | ✓ | ✓ | × | ✓ | × | × | |
✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
× | × | × | ✓ | ✓ | × | × | × | × | ✓ | × | × | |
× | × | × | ✓ | ✓ | × | × | × | × | ✓ | × | × | |
× | × | × | × | ✓ | × | × | × | × | ✓ | × | × | |
× | × | × | × | × | ✓ | × | × | × | ✓ | × | × | |
× | × | × | × | × | × | × | × | ✓ | ✓ | × | × | |
× | × | × | × | × | × | × | × | × | × | ✓ | × | |
✓ | ✓ | × | ✓ | × | × | × | × | × | ✓ | × | × | |
✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | × | ✓ | ✓ | ✓ | ✓ | |
✓ | ✓ | ✓ | ✓ | × | ✓ | × | × | × | ✓ | × | × | |
✓ | ✓ | ✓ | ✓ | × | ✓ | × | × | × | ✓ | × | × | |
× | × | × | × | × | × | × | × | × | × | × | ✓ |