To access a Lindorm search index using an open-source API, you must synchronize data from a wide table to an index table. You can achieve this by creating a column mapping between the wide table and the index table. This topic describes the configuration items for column mapping.
Limits
If you want to customize the index names and index column names of a search index, see Manage a search index using Lindorm Shell.
Configuration example
Column mapping between a wide table and an index table is configured using a JSON file. The following example shows a sample configuration for column mapping. In this example, data from the wide table testTable is synchronized to the index table democollection. The f1:name column of the wide table is mapped to the name_s column of the index table, and the f1:age column is mapped to the age_i column.
{
"sourceNamespace": "default",
"sourceTable": "testTable",
"targetIndexName": "democollection",
"indexType": "ES",
"rowkeyFormatterType": "STRING",
"fields": [
{
"source": "f1:name",
"targetField": "name_s",
"type": "STRING"
},
{
"source": "f1:age",
"targetField": "age_i",
"type": "INT"
}
]
}Ensure that each column in the column mapping is explicitly defined in the search engine and that the column names and data types are consistent with the mapping.
Configuration items
The following table describes the configuration items used to configure column mapping between a wide table and an index table.
Parameter | Description |
sourceNamespace | The namespace of the wide table. If the wide table does not have a namespace, the default namespace is `default`. |
sourceTable | Required. The name of the wide table. |
targetIndexName | Required. The name of the index table in the Lindorm search engine. |
indexType | The default value is `ES`. |
rowkeyFormatterType | Specifies how the primary key of each row in the wide table is mapped to the primary key ID (of the String data type) in the index table. The following values are supported:
|
fields | Specifies the columns and types to be mapped. It consists of the following three parameters. If you configure multiple columns, separate them with commas (,).
|