Procedure:
1. Configure the file that you want to use to create an application schema. Set the name and type of each field in the application schema. The following sample code provides an example:
{
"table_name": {
"INT": 1,
"INT_ARRAY": [
1,
2,
3,
4
],
"FLOAT": 12.5,
"FLOAT_ARRAY": [
12.1,
12.2,
12.3
],
"DOUBLE": 12.6,
"DOUBLE_ARRAY": [
12.1,
12.2,
12.3
],
"LITERAL": "LITERAL",
"LITERAL_ARRAY": [
"OpenSearch",
"Open",
"Search"
],
"SHORT_TEXT": "SHORT_TEXT",
"TEXT": "TEXT",
"TIMESTAMP": 1624502392077,
"GEO_POINT": "12 15"
}
}
Note: You can customize the value of a field based on the field type.
2. Log on to the OpenSearch console. In the left-side navigation pane, click Instance Management. On the Instance Management page, find the application that you want to configure and click Configure in the Actions column. In the Application Schema step of the Configure Application wizard, click Use File. In the Select File panel, upload the file that you configured in Step 1.
3. Modify the mapped field types. The following figure shows an example.
If the system cannot accurately identify the types of specific fields based on field values, the field types that are automatically mapped by the system may not meet your requirements. In this case, you need to modify the field types based on your business requirements.