Insert data

更新时间:
复制 MD 格式

Insert data in form mode

Insert vector data

On the Vector Management > Insert Data page, select a table.

In form mode, you can insert only a single record at a time. After you select a table, the page displays the field structure. For example, you may see the field id (primary key, INT64) and the field float (dense vector, FLOAT, multi-value). The vector must have a dimension of 128, and you must enter the content in an array format, 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, enter 1 for the id field and a 128-dimensional floating-point array, such as [0.1, 0.2, 0.3, ...], for the vector field.

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, and 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.

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], and 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.

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 and source_text (embedding field) to OpenSearch Vector Search Edition. The 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, and TopK to 10. For query type, select 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.

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. The 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, and multi-subject recognition to Disabled. For image source, select Upload image file. 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.

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 and 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.

In the upper-right corner, switch to developer mode. In the JSON editor, enter the data as a JSON array where each object represents a record. Include values for the primary key and vector fields, and then 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.

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.

In the upper-right corner, switch to developer mode. Enter the data as a JSON array. Each record should include the primary key, dense vector, sparse vector indices, and sparse vector values, and then click Add.

The data is submitted as a JSON array of record objects. The fields in each object correspond to the table fields, such as id (primary key), vector (dense vector), sparse_indices (sparse vector indices), sparse_values (sparse vector values), and namespace.

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.

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.

In the upper-right corner, switch to developer mode. Enter the values for the corresponding fields, including the primary key and the field for embedding, and then 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 as the table name.

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, and TopK to 10. Set query type to Text and 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.

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.

In the upper-right corner, switch to developer mode. Enter the data as a JSON array. Each record should include the primary key and the field for embedding. For the image field, provide the value as a base64-encoded string. Then, 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, such as 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, the sort order to ASC, and the 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.

Limitations

  • 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.