Insert data

Updated at:

Insert data in form mode

Insert vector data

On the Vector Management > Insert Data page, select a table into which to insert data:

Form mode supports only a single record. After you select a table, its fields are displayed, such as id (primary key, INT64) and float (dense vector, FLOAT, multi-value). The vector dimension must be 128. Enter an array, such as [0.1, 0.2, 0.3].

Enter the values for the corresponding fields, including the primary key and dense vector, and then click Add. For example, set id to 1, and set the vector field to a 128-dimensional floating-point array, such as [0.1, 0.2, 0.3, ...].

A response of "message": "success" indicates that the data was uploaded successfully.

After a successful upload, you can query the data on the Query Test page.

In the left-side navigation pane, choose Vector Management > Query Test and select the Vector Query tab. Set table name to test,TopK to 10,query type to Vector,sort order to ASC. In the Vector input box, enter the query vector, and then click Search. The query returns one matching record with a distance score of 0, a primary key of 1, and a query latency of 5.93 ms.

Insert data for a hybrid search

On the Vector Management > Insert Data page, select a table into which to insert data:

Select the test_hybrid_search table and switch to form mode to insert a single record. The dense vector must have a dimension of 128 and be in an array format, such as [0.1, 0.2, 0.3].

Enter the values for the corresponding fields, including the primary key, dense vector, sparse vector indices, and sparse vector values, and then click Add:

For example, select form mode and set the table name to test_hybrid_search. Set id to 1,vector to [0.03,0.15,0.91,0.17,...],sparse_indices to [1,2,3],sparse_values to [0.1,0.2,0.3],namespace to 1.

A response of "message": "success" indicates that the data was uploaded successfully.

After a successful upload, you can query the data on the Query Test page.

Select the Vector-Text Hybrid Query tab. Set the table name (e.g., test_hybrid_search),TopK (e.g., 10),filter condition (e.g., price > 100),index name, and sort order. Enter the dense vector,sparse vector indices (e.g., [1,2,3]), and sparse vector values (e.g., [0.1,0.2,0.3]), and then click Search to view the hybrid search results.

Insert text data for embedding

On the Vector Management > Insert Data page, select a table into which to insert data:

Select the test_text_api table. The table includes the following fields: id (primary key, INT64), source_text_vector (dense vector, FLOAT, automatically generated by OpenSearch, no input required), source_text (a STRING field for embedding), and namespace(INT64).

Enter the values for the corresponding fields, including the primary key and the field for embedding, and then click Add:

Select the test_text_api table. Set id (primary key) to 1,source_text (embedding field) to OpenSearch Vector Search Edition.source_text_vector (dense vector) is automatically generated by OpenSearch, so no input is required.

A response of "message": "success" indicates that the data was uploaded successfully.

After a successful upload, you can query the data on the Query Test page.

On the Query Test page, select the Vector Query tab. Set table name to test_text_api,index name to source_text_vector,TopK to 10,query type to Text. In the text input box, enter Vector Search Edition, and then click Search. The query returns one matching result with a distance score of 0.389988780021675 and a primary key of 1. The returned attributes show the source_text value is OpenSearch Vector Search Edition, confirming a successful text-to-vector query.

Insert image data for embedding

On the Vector Management > Insert Data page, select a table into which to insert data:

Select form mode and select the target table. In the field list, the source_image_vector (dense vector) field is automatically generated by OpenSearch, so no input is required.

Enter the values for the corresponding fields, including the primary key and the field for embedding. For the image field, you can either upload an image or provide its base64 encoding. Then, click Add:

For this example, select the test_create table and fill in the fields. Set the id (primary key) to 1,source_image_vector (dense vector) is automatically generated by OpenSearch. For source_image (field for embedding), upload an image file. Set the namespace to 1.

A response of "message": "success" indicates that the data was uploaded successfully.

After a successful upload, you can query the data on the Query Test page.

Set query type to Image,sort order to ASC,Image Provision Method to Upload Image File,Multi-subject Recognition to Disabled. After uploading the image you want to search for, click Search. The search results display the matching records, including their distance score, primary key, vector value, and attributes.

Insert data in developer mode

Insert vector data

On the Vector Management > Insert Data page, select a table into which to insert data:

The page defaults to form mode, which supports inserting only a single record at a time. After you select a table name, a list of fields is displayed with columns for field name, field labels (such as primary key,dense vector), and data type. The input box for a vector field indicates the required dimension and array format, such as [0.1, 0.2, 0.3]. After filling in the details, click Add.

Select developer mode in the upper-right corner, enter the field values, including the primary key and vector field, and click Add:

The example JSON data format is [{"id": 0, "float": [0.03, 0.15, 0.91, 0.17, ...]}], where id is the primary key field and float is the vector field in a floating-point array format.

A response of "message": "success" indicates that the data was uploaded successfully.

After a successful upload, you can query the data on the Query Test page.

On the Query Test page, select the Vector Query tab. Set the table name,index name, and TopK. In the vector input box, enter the query vector in a floating-point array format, and then click Search. The results include the distance score, primary key, and vector values.

Insert data for a hybrid search

On the Vector Management > Insert Data page, select a table into which to insert data:

Select the test_hybrid_search table. The page defaults to form mode and displays five fields: id (primary key), vector (dense vector), sparse_indices (sparse vector indices), sparse_values (sparse vector values), and namespace.

Select developer mode in the upper-right corner, enter the primary key, dense vector, sparse vector indices, and sparse vector values, and click Add:

The JSON fields correspond to the preceding fields as follows: id (primary key), vector (dense vector), sparse_indices (sparse vector indices), sparse_values (sparse vector values), and namespace field. Submit the data as a JSON array, with each element representing one record.

A response of "message": "success" indicates that the data was uploaded successfully.

After a successful upload, you can query the data on the Query Test page.

Select the Vector-Text Hybrid Query tab. From the table name drop-down list, select the target table, such as test_hybrid_search. Set TopK (e.g., 10), index name (e.g., vector), and sort order (e.g., DESC). Enter the dense vector,sparse vector indices (e.g., [1,2,3]), and sparse vector values (e.g., [0.1,0.2,0.3]), and then click Search. The search results are displayed in a table and include information such as distance score, primary key, dense vector value, sparse vector indices, sparse vector values, attributes, and namespace.

Insert text data for embedding

On the Vector Management > Insert Data page, select a table into which to insert data:

Select the test_text_api table. The page defaults to form mode, which supports inserting only a single record. The field list includes id (primary key), source_text_vector (dense vector, automatically generated by OpenSearch, no input required), source_text (a field for embedding), and namespace.

Select developer mode in the upper-right corner, enter the primary key and field to embed, and click Add:

An example JSON payload is [{"id": 1, "source_text": "OpenSearch Vector Search Edition", "namespace": 1}]. In this example, id is the primary key, source_text is the text field for embedding, and namespace is the namespace. Select test_text_api.

A response of "message": "success" indicates that the data was uploaded successfully.

After a successful upload, you can query the data on the Query Test page.

On the Query Test page, select the Vector Query tab. Set table name to test_text_api,index name to source_text_vector,TopK to 10,query type to Text,sort order to ASC. In the text input box, enter the query text (e.g., Vector Search Edition), and then click Search. The query returns one matching record with a distance score of 0.389988780021675 and a primary key of 1. In the attributes, the source_text value is OpenSearch Vector Search Edition.

Insert image data for embedding

On the Vector Management > Insert Data page, select a table into which to insert data:

In form mode, select the test_create table. The fields include id (primary key, INT64), source_image_vector (dense vector, automatically generated by OpenSearch, no input required), source_image (a field for embedding, which can be provided by uploading an image or entering its base64 encoding), and namespace (INT64). After you fill in the details, click Add.

Select developer mode in the upper-right corner, enter the primary key and field to embed (provide image data as a Base64-encoded string), and click Add:

The data is submitted as a JSON array. Each record contains fields such as id (primary key), source_image (the base64-encoded image string), and namespace. Select the target table (for example, test_create).

A response of "message": "success" indicates that the data was uploaded successfully.

After a successful upload, you can query the data on the Query Test page.

Set the query type to Image,sort order to ASC,image source to Upload image file. After you upload the image to search for, click Search. The search results are displayed in a table with columns for distance score, primary key, vector value, attributes, and namespace. A smaller distance score indicates a better match.

Usage notes

  • The payload for a single data record must not exceed 1 MB.

  • For image data that requires embedding, the source image file can exceed 1 MB.

  • For text data to be embedded, the source text must not exceed 1 KB.