FieldSchema specifies the configurations of all fields in a search index.
Data structure
message FieldSchema {
optional string field_name = 1;
optional FieldType field_type = 2;
optional string analyzer = 4;
optional bool index = 5;
optional bool sort_and_agg = 6;
optional bool store = 7;
repeated FieldSchema field_schemas = 8; // only for nested type
optional bool is_array = 9;
optional bytes analyzer_parameter = 10;
optional bool is_virtual_field = 11;
repeated string source_field_names = 12;
repeated string date_formats = 13;
}
Parameter | Type | Required | Description |
field_name | string | Yes | The name of the field. Important The field name must be the same as the field name in the data table. |
field_type | Yes | The type of the field. For more information, see Data type mappings. Important The field type of the search index must match the field type in the data table. | |
analyzer | string | No | The tokenization method. By default, single-word tokenization is specified. This parameter is available only when you set field_type to TEXT. |
index | bool | No | Specifies whether to enable indexing. Default value: true. A value of true specifies that Tablestore indexes the column with an inverted indexing schema or a spatio-temporal indexing schema. A value of false specifies that Tablestore does not enable indexing for the column. |
sort_and_agg | bool | No | Specifies whether to enable the sorting and aggregation features. Only fields for which sorting and aggregation features are enabled can be sorted. |
store | bool | No | Specifies whether to store the value of the field in the search index. If you set the store parameter to true, you can read the value of the field from the search index without querying the data table. This improves query performance. |
field_schemas | repeated FieldSchema | No | The field configuration information. This parameter is required only if the field is of the nested data type. |
is_array | bool | No | Specifies whether the value is an array. If you set this parameter to true, the column is an array. Data written to the column must be a JSON array such as This parameter is optional only if the field is of the nested data type. |
analyzer_parameter | bytes | No | The configurations of optional parameters for tokenization. The value must be encoded in protobuf. Different optional parameter configurations are supported for different tokenization types. For more information, see Tokenization. |
is_virtual_field | bool | No | Specifies whether the field is a virtual column. Default value: false. This parameter is required only when you use virtual columns. |
source_field_names | string | No | The name of the field in the data table. This parameter is required only when you use virtual columns and set is_virtual_field to true. |
date_formats | string | No | The format of the date. This parameter is required only when you set field_type to DATE. |