Import data through DataWorks

Updated at:

This topic describes how to use the OpenSearch Writer in DataWorks Data Integration to import offline data into OpenSearch Vector Search Edition in script mode. It includes a sample Writer script, parameter descriptions, and limitations.

Scope

This topic applies to OpenSearch Vector Search Edition and Retrieval Engine Edition.

Limitations

Configure a batch synchronization task

The following sections describe where to configure the task and how to complete the general configuration.

Appendix: Writer script example and parameters

Configure a batch task in script mode

When you configure a batch task in script mode, enter the required parameters using the standard task script format. For more information, see Configure a synchronization task in script mode. The following sections describe the data source parameters for script mode.

Writer script example

The following example shows a Writer configuration fragment. Adjust the parameters to match your data source, table, and fields.

{
  "stepType": "opensearch",
  "parameter": {
    "indexName": "",
    "column": [
      {
        "name": "col3double",
        "type": "DOUBLE"
      },
      {
        "name": "col2vector",
        "type": "MULTI_FLOAT"
      }
    ],
    "datasource": "zm_test_vector_01",
    "batchSize": "500",
    "table": "demotable"
  },
  "name": "Writer",
  "category": "writer"
}

Writer script parameters

Parameter

Description

Required

Default value

table

The destination table. Specify only one table because DataX cannot import data into multiple tables in a single operation.

Yes

None

column

The list of fields to import. For the field configuration format, see Writer script example.

Yes

None

batchSize

The number of records per write operation. OpenSearch writes data in batches and is optimized for queries, so its write throughput in transactions per second (TPS) is typically low. Set this value based on the resources allocated to your account.

Typically, each OpenSearch record is smaller than 1 MB, and each batch write is smaller than 2 MB.

-

300

FAQ

Column configuration errors

The OpenSearch Writer returns an error if a write contains extra columns. This prevents those columns from being silently dropped. For example, if the OpenSearch table contains columns a, b, and c, the Writer returns an error when you write more than three columns.

Table configuration

The OpenSearch Writer can write to only one table at a time.

Task reruns and failover

When a task reruns, OpenSearch automatically overwrites records with matching IDs. The columns written to OpenSearch must therefore include an ID column that uniquely identifies each record.

Related documentation

DataWorks: OpenSearch data source