OpenSearch allows you to import data by configuring data sources, using the API or SDKs, or uploading files in the OpenSearch console. Data import by using the API or SDK is flexible and user-friendly.
Field type mappings
Field type in OpenSearch | Type of field imported by using the API |
INT | int and long |
INT_ARRAY | int [] and long [] |
FLOAT | float |
FLOAT_ARRAY | float [] |
DOUBLE | double |
DOUBLE_ARRAY | double [] |
LITERAL | string |
LITERAL_ARRAY | string [] |
SHORT_TEXT | string |
TEXT | string |
TIMESTAMP | long |
GEO_POINT | string, in the format of lon lat. lon specifies the longitude, and lat specifies the latitude. Both the longitude and latitude values must be of the DOUBLE type and are separated by a space character. Valid values of the lon parameter: [-180, 180]. Valid values of the lat parameter: [-90,90]. |
Usage notes
1. We recommend that you upload files in the OpenSearch console to import data only for search tests. This is because you can upload at most 2 MB of files at a time in the console, and it is time-consuming to upload a large number of files. For information about the limits on data import by using the API or SDKs, see Limits.

2. If you use the API or SDK to import data, you cannot use data source plug-ins. You must concatenate and process data before you import data to OpenSearch applications. For example, when you use the API to upload data of array types, you must upload the data in arrays but not in strings. Example:
// Create a Map object named doc2 to store the data of document 2 to be uploaded.
Map<String,Object> doc2 =Maps.newLinkedHashMap();
doc2.put("id",1);
String[] literal_arr2 ={"Element 1","Element 2"};
doc2.put("literal_arr", literal_arr2);3. For more information about data import by using the API or SDKs, see: