Predefined columns are non-primary key columns whose names and types are defined when a data table is created. Predefined columns can be used as the fields of a secondary index that is created for the data table. This topic describes how to use predefined columns.
Usage notes
You do not need to add predefined columns to a data table when you want to use a search index that is created for the data table.
You can specify up to 32 predefined columns for a data table. To specify more predefined columns for a data table, submit a ticket.
The attribute columns of a secondary index must be one or more of the predefined columns.
Use predefined columns
If you create a secondary index for a table and the table does not contain predefined columns or the existing predefined columns do not meet your business requirements, you can add or remove the predefined columns in the table. For more information, see Use secondary indexes in the Tablestore console and Get started with secondary indexes by using Tablestore SDKs.
You can also add predefined columns when you create a data table. For more information, see Operations on data tables.
For example, a data table consists of the pk1, pk2, and pk3 primary key columns, the col1 and col2 predefined columns, and the col3 and col4 attribute columns. When you create a secondary index, the pk1, pk2, and pk3 columns can be used only as the primary key columns of the secondary index. The col1 and col2 columns can be used as the primary key columns or attribute columns of the secondary index. The col3 and col4 columns cannot be used as the columns of the secondary index.