ALIYUN::OTS::SearchIndex creates a search index on a data table. You can create multiple search indexes on a single table.
Syntax
{
"Type": "ALIYUN::OTS::SearchIndex",
"Properties": {
"IndexName": String,
"InstanceName": String,
"TableName": String,
"FieldSchemas": List,
"IndexSort": Map,
"IndexSetting": Map
}
}
Properties
|
Property |
Type |
Required |
Editable |
Description |
Constraint |
|
IndexName |
String |
Yes |
No |
The search index name. |
None. |
|
InstanceName |
String |
Yes |
No |
The instance that contains the data table. |
None. |
|
TableName |
String |
Yes |
No |
The data table name. |
None. |
|
FieldSchemas |
List |
Yes |
No |
The field schemas. |
None. |
|
IndexSort |
Map |
No |
No |
The search index presorting settings. Default: sorted by primary key. |
You can skip presorting for search indexes that contain nested fields. For more information, see IndexSort property. |
|
IndexSetting |
Map |
No |
No |
The search index settings. |
For more information, see IndexSetting property. |
IndexSort syntax
"IndexSort": {
"Sorters": List
}
IndexSort property
|
Property |
Type |
Required |
Editable |
Description |
Constraint |
|
Sorters |
List |
Yes |
No |
The presorting method. |
Supported methods: PrimaryKeySort and FieldSort. For more information, see Sorting and paging and Sorters properties. |
Sorters syntax
"Sorters": [
{
"FieldSort": Map,
"PrimaryKeySort": Map,
"ScoreSort": Map,
"GeoDistanceSort": Map
}
]
Sorters properties
|
Property |
Type |
Required |
Editable |
Description |
Constraint |
|
FieldSort |
Map |
No |
No |
Sorts data by field value. |
For more information, see FieldSort properties. |
|
PrimaryKeySort |
Map |
No |
No |
Sorts data by primary key. |
For more information, see PrimaryKeySort property. |
|
ScoreSort |
Map |
No |
No |
Sorts data by BM25-based keyword relevance score. Suitable for full-text search scenarios. |
Required to sort matched data by relevance score. Without ScoreSort, matched data follows the IndexSort presorting settings. For more information, see ScoreSort property. |
|
GeoDistanceSort |
Map |
No |
No |
Sorts data by geographical distance. |
For more information, see GeoDistanceSort properties. |
FieldSort syntax
"FieldSort": {
"SortMode": String,
"SortOrder": String,
"FieldName": String
}
FieldSort properties
|
Property |
Type |
Required |
Editable |
Description |
Constraint |
|
SortMode |
String |
No |
No |
The sort method when the field has multiple values. |
None. |
|
SortOrder |
String |
No |
No |
The sort order. |
Valid values:
|
|
FieldName |
String |
Yes |
No |
The field used to sort data. |
None. |
PrimaryKeySort syntax
"PrimaryKeySort": {
"SortOrder": String
}
PrimaryKeySort property
|
Property |
Type |
Required |
Editable |
Description |
Constraint |
|
SortOrder |
String |
No |
No |
The sort order. |
Valid values:
|
ScoreSort syntax
"ScoreSort": {
"SortOrder": String
}
ScoreSort property
|
Property |
Type |
Required |
Editable |
Description |
Constraint |
|
SortOrder |
String |
No |
No |
The sort order. |
Valid values:
|
GeoDistanceSort syntax
"GeoDistanceSort": {
"Points": List,
"SortMode": String,
"SortOrder": String,
"FieldName": String
}
GeoDistanceSort properties
|
Property |
Type |
Required |
Editable |
Description |
Constraint |
|
Points |
List |
Yes |
No |
The coordinates that form the polygon. |
Specify the coordinates in the |
|
SortMode |
String |
No |
No |
The sort method when the field has multiple values. |
None. |
|
SortOrder |
String |
No |
No |
The sort order. |
Valid values:
|
|
FieldName |
String |
Yes |
No |
The field used to sort data. |
None. |
IndexSetting syntax
"IndexSetting": {
"RoutingFields": List
}
IndexSetting property
|
Property |
Type |
Required |
Editable |
Description |
Constraint |
|
RoutingFields |
List |
No |
No |
The custom routing fields. |
Specify primary key columns as routing fields. Tablestore distributes data written to a search index across partitions based on routing field values. Data with the same routing field values goes to the same partition. |
FieldSchemas syntax
"FieldSchemas": [
{
"Index": Boolean,
"IsArray": Boolean,
"Analyzer": String,
"EnableSortAndAgg": Boolean,
"Store": Boolean,
"SubFieldSchemas": List,
"FieldName": String,
"FieldType": String
}
]
FieldSchemas properties
|
Property |
Type |
Required |
Editable |
Description |
Constraint |
|
Index |
Boolean |
No |
No |
Whether to enable indexing. |
Valid values:
|
|
IsArray |
Boolean |
No |
No |
Whether the value is an array. |
Valid values:
|
|
Analyzer |
String |
No |
No |
The analyzer type. |
Applicable to text fields. Non-text fields default to single-word tokenization. For more information, see Tokenization. |
|
EnableSortAndAgg |
Boolean |
No |
No |
Whether to enable sorting and aggregation. |
Valid values:
|
|
Store |
Boolean |
No |
No |
Whether to store the field value in the search index. |
Valid values:
If set to true, the field value can be read directly from the search index without querying the data table, which improves query performance. |
|
SubFieldSchemas |
List |
No |
No |
The subfield schemas. Required for nested fields to configure subfield index types. |
None. |
|
FieldName |
String |
Yes |
No |
The field name in the search index, also called the column name. |
Can be a primary key column or an attribute column. |
|
FieldType |
String |
Yes |
No |
The field data type. |
Use the FieldType.XXX format. Valid values:
For more information, see Data types. |
SubFieldSchemas syntax
"SubFieldSchemas": [
{
"Index": Boolean,
"IsArray": Boolean,
"Analyzer": String,
"EnableSortAndAgg": Boolean,
"Store": Boolean,
"FieldName": String,
"FieldType": String
}
]
SubFieldSchemas properties
|
Property |
Type |
Required |
Editable |
Description |
Constraint |
|
Index |
Boolean |
No |
No |
Whether to enable indexing. |
Valid values:
|
|
IsArray |
Boolean |
No |
No |
Whether the value is an array. |
Valid values:
|
|
Analyzer |
String |
No |
No |
The analyzer type. |
Applicable to text fields. Non-text fields default to single-word tokenization. For more information, see Tokenization. |
|
EnableSortAndAgg |
Boolean |
No |
No |
Whether to enable sorting and aggregation. |
Valid values:
|
|
Store |
Boolean |
No |
No |
Whether to store the field value in the search index. |
Valid values:
If set to true, the field value can be read directly from the search index without querying the data table, which improves query performance. |
|
FieldName |
String |
Yes |
No |
The field name in the search index, also called the column name. |
Can be a primary key column or an attribute column. |
|
FieldType |
String |
Yes |
No |
The field data type. |
Use the FieldType.XXX format. For more information, see Data types. |
Return values
Fn::GetAtt
IndexName: the search index name.
Examples
The ots.yml template uses the ALIYUN::OTS::Instance, ALIYUN::OTS::SearchIndex, ALIYUN::OTS::Table, and ALIYUN::OTS::VpcBinder resource types.