All Products
Search
Document Center

Import data by using the API or SDKs

Last Updated: Sep 15, 2021

OpenSearch allows you to import data from data sources or use the API, SDKs, or the console to upload files to import data. Data import by using the API or SDKs is flexible. For more information, see Data processing, Demo for pushing data by using the SDK for Java, and Demo for pushing data by using the SDK for PHP.

Note:

1.We recommend that you upload files in the OpenSearch console only for search tests. This is because you can upload at most 2 MB of files at a time in the console, which is time-consuming for uploading large amounts of files. For more information about the system limits on pushing data by using the API or SDKs, see Limits.

1

2.If you use the API or SDKs to import data, you cannot use data source plug-ins. You must concatenate and process the data before you import the data to OpenSearch applications. For example, when you use the API to upload data of the ARRAY type, you must upload the data in arrays but not in strings, as shown in the following code:

// Define the map object that is used to store 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);