All Products
Search
Document Center

Lindorm:Configure column mapping

Last Updated:Aug 09, 2025

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"
    }
  ]
}
Important

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:

  • `STRING`: Use this value if the primary key of the wide table is of the String type, such as `row1` or `order0001`. This method uses the `Bytes.toString(byte[])` function to convert the primary key of the wide table to the primary key ID of the index table. After you find the primary key ID of the result data based on a condition in the index, you can use the `Bytes.toBytes(String)` function to convert the primary key ID back to the primary key of the wide table.

  • `HEX`: Use this value if the primary key of the wide table is not of the String type, such as `12345`. This method uses the `encodeAsString(byte[])` function from the `org.apache.commons.codec.binary.Hex` package to convert the primary key of the wide table to the primary key ID of the index table. After you find the primary key ID of the result data based on a condition in the index, you can use the `Hex.decodeHex(String.toCharArray())` function to convert the primary key ID back to the primary key of the wide table.

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 (,).

  • source: The name of the column to be mapped in the wide table. Use a colon (:) to separate the column family name and the column name.

  • targetField: The name of the column in the index table to which the source column is mapped.

  • type: The data type of the column to be mapped in the wide table. The value is case-sensitive. The following data types are supported:

    • INT

    • LONG

    • STRING

    • BOOLEAN

    • FLOAT

    • DOUBLE

    Note

    Make sure that the data type in the wide table is consistent with the configured data type. Otherwise, the generation of index data is affected. In LindormTable, call the Bytes.toBytes(string/long/int/...) method to convert the data to bytes before storing it in the wide table.