An application schema defines how your data is structured for indexing and search. When you upload data to OpenSearch, it is first stored in offline data tables. Each data table holds one or more fields. After processing, the tables are joined into an index table, which defines search attributes that the search engine uses to build indexes and return results.
If you use multiple data tables, specify the join fields before data processing begins.
How it works
Data source → Offline data tables → [Join on specified fields] → Index table → Search engineEach field in a data table maps to an OpenSearch field type. The field type determines how data is indexed, how it can be queried, and which analysis methods apply.
Field types
OpenSearch High-performance Search Edition supports the following field types, grouped by purpose.
Full-text search
Use these types for fields that need tokenization and multiple analysis methods.
| Field type | Description |
|---|---|
SHORT_TEXT | Short text. Values must not exceed 100 bytes. Supports multiple analysis methods. |
TEXT | Long text. Supports multiple analysis methods. |
Exact match
Use these types for fields queried by exact value — filtering, sorting, or joining on a precise string.
| Field type | Description |
|---|---|
LITERAL | String constant. Supports exact match only. |
LITERAL_ARRAY | String constant array. Each element supports exact match only. |
Numeric
| Field type | Description |
|---|---|
INT | 64-bit integer. |
INT_ARRAY | 64-bit integer array. |
FLOAT | Floating-point number. |
FLOAT_ARRAY | Floating-point number array. |
DOUBLE | Floating-point number. |
DOUBLE_ARRAY | Floating-point number array. |
If your data source fields are FLOAT or DOUBLE type, change them to DECIMAL to avoid data precision issues.
Temporal
| Field type | Description |
|---|---|
TIMESTAMP | 64-bit unsigned integer representing a timestamp. Maps to DATETIME or TIMESTAMP in a data source. Values are automatically converted to milliseconds. Use the range function to filter results by time range. |
Fields of the INT type can also be mapped to a DATETIME or TIMESTAMP field in a data source. The values are automatically converted to milliseconds. Use the range function to filter results by time range.
Geographic
| Field type | Description |
|---|---|
GEO_POINT | String constant representing a geographic coordinate in "Latitude value Longitude value" format. |
Usage notes
Array types
Array field types (INT_ARRAY, FLOAT_ARRAY, DOUBLE_ARRAY, LITERAL_ARRAY) follow the same general pattern:
In a data source, map the field to a VARCHAR or STRING column. Use the
MultiValueSpliterdata processing plug-in to convert it.When uploading via the OpenSearch API or SDKs, send the field as an array, not a string.
// Correct: array
String[] literal_array = {"Alibaba Cloud", "OpenSearch"};For DOUBLE_ARRAY fields in ApsaraDB RDS and PolarDB data sources, only VARCHAR is supported (not STRING). For MaxCompute, both VARCHAR and STRING are supported.Reserved field names
Do not use these names for your own fields. Using a reserved name causes data upload failures or unexpected behavior.
Reserved names: service_id, ops_app_name, inter_timestamp, index_name, pk, ops_version, ha_reserved_timestamp, summary
Field value limits
Each field type enforces value range limits. If a value falls outside the allowed range, an overflow error occurs or the value is truncated. For the full list, see the "Limits on fields" section of Limits.
Data source field type mappings
Use these tables to map fields from your data source to OpenSearch field types.
Supported field types by data source
| Data source | Supported field types |
|---|---|
| ApsaraDB RDS | TINYINT, SMALLINT, INTEGER, BIGINT, FLOAT, REAL, DOUBLE, NUMERIC, DECIMAL, TIME, DATE, TIMESTAMP, VARCHAR |
| PolarDB | TINYINT, SMALLINT, INTEGER, BIGINT, FLOAT, REAL, DOUBLE, NUMERIC, DECIMAL, TIME, DATE, TIMESTAMP, VARCHAR |
| MaxCompute | BIGINT, DOUBLE, BOOLEAN, DATETIME, STRING, DECIMAL, MAP, ARRAY, TINYINT, SMALLINT, INT, FLOAT, CHAR, VARCHAR, DATE, TIMESTAMP, BINARY, INTERVAL_DAY_TIME, INTERVAL_YEAR_MONTH, STRUCT |
Field type mapping reference
| OpenSearch type | ApsaraDB RDS | PolarDB | MaxCompute |
|---|---|---|---|
INT | BIGINT, TINYINT, SMALLINT, INTEGER | BIGINT, TINYINT, SMALLINT, INTEGER | BIGINT, TINYINT, SMALLINT, INT |
INT_ARRAY | VARCHAR, STRING (via MultiValueSpliter) | VARCHAR, STRING (via MultiValueSpliter) | VARCHAR, STRING (via MultiValueSpliter) |
FLOAT | FLOAT, NUMERIC, DECIMAL | FLOAT, NUMERIC, DECIMAL | FLOAT, DECIMAL |
FLOAT_ARRAY | VARCHAR, STRING (via MultiValueSpliter) | VARCHAR, STRING (via MultiValueSpliter) | VARCHAR, STRING (via MultiValueSpliter) |
DOUBLE | DOUBLE, NUMERIC, DECIMAL | DOUBLE, NUMERIC, DECIMAL | DOUBLE, DECIMAL |
DOUBLE_ARRAY | VARCHAR (via MultiValueSpliter) | VARCHAR (via MultiValueSpliter) | VARCHAR, STRING (via MultiValueSpliter) |
LITERAL | VARCHAR | VARCHAR | VARCHAR, STRING |
LITERAL_ARRAY | VARCHAR (via MultiValueSpliter) | VARCHAR (via MultiValueSpliter) | VARCHAR, STRING (via MultiValueSpliter) |
SHORT_TEXT | VARCHAR | VARCHAR | VARCHAR, STRING |
TEXT | VARCHAR | VARCHAR | VARCHAR, STRING |
TIMESTAMP | DATETIME, TIMESTAMP | DATETIME, TIMESTAMP | DATETIME, TIMESTAMP |
GEO_POINT | VARCHAR | VARCHAR | VARCHAR, STRING in "lon lat" format, where lon is longitude (range: [-180, 180]) and lat is latitude (range: [-90, 90]), both DOUBLE type, separated by a space |
Create an application schema
OpenSearch supports four methods for creating an application schema. Choose based on where your data lives and how much manual control you need.
| Method | When to use |
|---|---|
| Configure a data source | Your data is in ApsaraDB RDS for MySQL, MaxCompute, or PolarDB for MySQL, and you want OpenSearch to infer the schema automatically. See Configure an ApsaraDB RDS for MySQL data source, Configure a MaxCompute data source, and Configure a PolarDB for MySQL data source. |
| Manually create | You want full control over field types, analysis methods, and index attributes. |
| Use a template | You are migrating an existing application and want to reuse its schema. See Migrate an application schema between applications. |
| Upload a file | You have a pre-defined schema file to import. See Create an application schema by uploading a file. |