All Products
Search
Document Center

Tablestore:Mappings of basic data types

Last Updated:Oct 15, 2024

This topic describes the mappings between the types of fields in search indexes and the types of fields in data tables. This topic also describes the additional attributes supported by various types of fields in search indexes.

The value of a field in a search index is the value of the field that has the same name in the data table for which the search index is created. The data types of the two values must match. The following table describes the matching rules.

Important

The data type of a field in the search index must match the data type of the field that has the same name in the data table based on the mappings described in the following table. Otherwise, Tablestore discards the data as dirty data. Make sure that the values of the fields of the Geo-point and Nested types comply with the formats described in the following table. If the format of data is invalid, Tablestore discards the data as dirty data. In this case, the data may be available in the data table but unavailable for queries 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 query.

Text

String

A string or text that can be tokenized. For more information, see Tokenization.

Date

Integer and String

The Date data type. You can specify the format of data of the Date type. For more information, see Date data type.

Geo-point

String

The coordinate pair of a geographical location, in the latitude,longitude format. Valid values of the latitude: [-90,+90]. Valid values of the longitude: [-180,+180]. Example: 35.8,-45.91.

Vector

String

The vector type. The value of a field of the Vector type is a string in the Float32 array format. The length of the array is the same as the number of dimensions of the field. For example, the number of dimensions of the vector string [1, 5.1, 4.7, 0.08] is 4.

Nested

String

The nested type. Example: [{"a": 1}, {"a": 3}].

The following table describes the additional attributes of fields in search indexes.

Attribute

Type

Description

IsArray

Boolean

Specifies whether the value of the field is an array.

A value of true specifies that the value of the field is an array. Data written to the field must be a JSON array. Example: ["a","b","c"].

You do not need to specify the IsArray attribute for a nested field because a nested field is an array.

Data of the Array type can be used in all queries because arrays do not affect queries.

isVirtualField

Boolean

Specifies whether the field is a virtual column.

  • If you set this attribute to true, the field is a virtual column. If the field is a virtual column, you must specify the source field that is mapped to the field in the data table. For more information, see Virtual columns.

  • If you set this attribute to false, the field is not a virtual column. In this case, the data type of the field in the search index must match the data type of the column in the data table.

The following table describes the combinations of data types and field attributes.

Type

IsArray

isVirtualField

Long

Supported

Supported

Double

Supported

Supported

Boolean

Supported

Not supported

Keyword

Supported

Supported

FuzzyKeyword

Supported

Supported

Text

Supported

Supported

Date

Supported

Supported

Geo-point

Supported

Supported

Vector

Not supported. Vector fields are arrays.

Supported

Nested

Not supported. Nested fields are arrays.

Not supported