FieldSchema defines the field configuration for a search index. Each field in the search index requires a FieldSchema entry that specifies properties such as field type, tokenizer, and indexing behavior.
Parameters
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;
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;
optional bool enable_highlighting = 14;
optional VectorOptions vector_options = 15;
optional JsonType json_type = 16;
}Name | Type | Required | Description |
field_name | string | Yes | The name of the field. The name must match the corresponding field name in the data table. Important A mismatched field name causes index creation to fail. |
field_type | Yes | The field type. For more information, see Data types. Important The field type for the search index must match the corresponding field type in the data table. | |
analyzer | string | No | The tokenizer type. Default: single-word tokenization. Only applicable to TEXT fields. |
index | bool | No | Specifies whether to enable indexing for the field. Default: true. When set to true, an inverted index or spatial index is created. When set to false, no index is created. |
sort_and_agg | bool | No | Specifies whether to enable sorting and aggregation for the field. Only fields with sorting and aggregation enabled can be used for sorting. |
field_schemas | No | The subfield configurations. Required only when the field type is NESTED. | |
is_array | bool | No | Specifies whether the field is an array. When set to true, data written to this field must be in JSON array format, such as Not required for NESTED fields. |
analyzer_parameter | bytes | No | Optional tokenizer parameter settings. The value must be encoded by protobuf. Supported parameters vary by tokenizer type. For more information, see Tokenizers. |
is_virtual_field | bool | No | Specifies whether the field is a virtual column. Default: false. Required only when using virtual columns. |
source_field_names | string | No | The source field names in the data table that map to this virtual column. Required only when is_virtual_field is set to true. |
date_formats | string | No | The date formats. Required only for DATE fields. |
enable_highlighting | bool | No | Specifies whether to enable query highlight and summary. Default: false. Only TEXT fields support this feature. Set this parameter to true to enable query highlight and summary. |
vector_options | No | The configuration parameters for vector fields. Required when the field type is VECTOR. | |
json_type | No | The index type of the JSON field. Valid values: OBJECT and Object. Required when the field type is JSON. |