All Products
Search
Document Center

DataWorks:Elasticsearch data source

Last Updated:Jul 17, 2026

Elasticsearch data sources provide bidirectional read and write channels for synchronizing data between DataWorks and Elasticsearch.

Applicability

Public resource groups support Elasticsearch 5.x, while Serverless resource groups (recommended) and dedicated resource groups for data integration support Elasticsearch 5.x, 6.x, 7.x, and 8.x.

Note

Elasticsearch is an open-source, enterprise-grade search engine developed under the Apache license. Built on Lucene, it provides distributed search and data analysis capabilities. The following table maps core Elasticsearch concepts to their relational database counterparts.

Elasticsearch

Relational database

Elasticsearch (instance)

relational database (instance)

index

database

type

table

document

row

field

column

An Elasticsearch instance can contain multiple indexes. Each index holds multiple types, each type contains multiple documents, and each document consists of multiple fields. The Elasticsearch Writer plugin uses the Elasticsearch REST API to batch write data to Elasticsearch.

Supported versions

DataWorks supports Alibaba Cloud Elasticsearch versions 5.x, 6.x, 7.x, and 8.x, but not self-managed Elasticsearch.

Limitations

The following limitations apply to offline reads from and writes to Elasticsearch:

  • The Elasticsearch Reader fetches shard information from the server for data synchronization. All shards must be active during synchronization to prevent data inconsistency.

  • For Elasticsearch 6.x or later, you can use a serverless resource group (recommended) or an exclusive resource group for Data Integration.

  • scaled_float fields cannot be synchronized.

  • Indexes cannot be synchronized if their field names contain the keyword $ref.

Supported field types

Type

Offline read

Offline write

Real-time write

binary

Supported

Supported

Supported

boolean

Supported

Supported

Supported

keyword

Supported

Supported

Supported

constant_keyword

Not supported

Not supported

Not supported

wildcard

Not supported

Not supported

Not supported

long

Supported

Supported

Supported

integer

Supported

Supported

Supported

short

Supported

Supported

Supported

byte

Supported

Supported

Supported

double

Supported

Supported

Supported

float

Supported

Supported

Supported

half_float

Not supported

Not supported

Not supported

scaled_float

Not supported

Not supported

Not supported

unsigned_long

Not supported

Not supported

Not supported

date

Supported

Supported

Supported

date_nanos

Not supported

Not supported

Not supported

alias

Not supported

Not supported

Not supported

object

Supported

Supported

Supported

flattened

Not supported

Not supported

Not supported

nested

Supported

Supported

Supported

join

Not supported

Not supported

Not supported

integer_range

Supported

Supported

Supported

float_range

Supported

Supported

Supported

long_range

Supported

Supported

Supported

double_range

Supported

Supported

Supported

date_range

Supported

Supported

Supported

ip_range

Not supported

Supported

Supported

ip

Supported

Supported

Supported

version

Supported

Supported

Supported

murmur3

Not supported

Not supported

Not supported

aggregate_metric_double

Not supported

Not supported

Not supported

histogram

Not supported

Not supported

Not supported

text

Supported

Supported

Supported

annotated-text

Not supported

Not supported

Not supported

completion

Supported

Not supported

Not supported

search_as_you_type

Not supported

Not supported

Not supported

token_count

Supported

Not supported

Not supported

dense_vector

Not supported

Not supported

Not supported

rank_feature

Not supported

Not supported

Not supported

rank_features

Not supported

Not supported

Not supported

geo_point

Supported

Supported

Supported

geo_shape

Supported

Supported

Supported

point

Not supported

Not supported

Not supported

shape

Not supported

Not supported

Not supported

percolator

Not supported

Not supported

Not supported

string

Supported

Supported

Supported

How it works

The Elasticsearch Reader works as follows:

  • It uses the Elasticsearch _searchscrollslice API, combining its scroll slice feature with the multi-threaded sharding of Data Integration.

  • It converts data types based on the mapping configuration in Elasticsearch.

For more information, see the official Elasticsearch documentation.

Note

The Elasticsearch Reader fetches shard information from the server for data synchronization. To prevent data inconsistency, you must ensure that all server-side shards remain active during data synchronization.

Basic configuration

Important

In production, remove comments from the code before running the job.

{
 "order":{
  "hops":[
   {
    "from":"Reader",
    "to":"Writer"
   }
  ]
 },
 "setting":{
  "errorLimit":{
   "record":"0" // The error limit. The job stops if the error count exceeds this value.
  },
  "jvmOption":"",
  "speed":{
   "concurrent":3, // The number of concurrent threads.
   "throttle":true,
   "mbps":"12"    // The maximum speed in MB/s.
  }
 },
 "steps":[
  {
   "category":"reader",
   "name":"Reader",
   "parameter":{
    "column":[ // The columns to read.
     "id",
     "name"
    ],
    "endpoint":"", // The service endpoint.
    "index":"",  // The source index.
    "password":"",  // The password for authentication.
    "scroll":"",  // The scroll context duration.
    "search":"",  // The query body, same as the `query` object in an Elasticsearch `_search` request.
    "type":"default",
    "username":""  // The username for authentication.
   },
   "stepType":"elasticsearch"
  },
  {
   "stepType": "elasticsearch",
            "parameter": {
                "column": [ // The columns to write.
                    {
                        "name": "id",
                        "type": "integer"
                    },
                    {
                        "name": "name",
                        "type": "text"
                    }
                ],
                "index": "test",   // The destination index.
                 "indexType": "",   // The index type. Leave this empty for Elasticsearch v7.x or later.
                "actionType": "index",  // The write mode.
                "cleanup": false,         // Specifies whether to recreate the index before writing.
                "datasource": "test",   // The data source name.
                "primaryKeyInfo": {     // The primary key configuration.
                    "fieldDelimiterOrigin": ",",
                    "column": [
                        "id"
                    ],
                    "type": "specific",
                    "fieldDelimiter": ","
                },
                "dynamic": false,  // Specifies whether to enable dynamic mapping.
                "batchSize": 1024   // The number of documents to write per batch.
            },
            "name": "Writer",
            "category": "writer"
  }
 ],
 "type":"job",
 "version":"2.0" // The version number.
}

Advanced features

  • Full document pull

    You can pull the entire content of an Elasticsearch document into a single field. For configuration details, see Scenario 1: Full document pull.

  • Transform semi-structured data to structured data

    Category

    Description

    References

    Background

    Elasticsearch data often has dynamic fields and deep nesting. This feature transforms semi-structured data into structured data for downstream computation and storage.

    How it works

    The solution parses JSON data from Elasticsearch, uses path expressions to flatten nested structures, and maps the results to structured tables. Complex documents can be split into multiple tables as needed.

    Solutions

    For nested JSON data, use a path to access specific properties.

    • property

    • property.sub-property

    • property[0].sub-property

    Scenario 2: Synchronize nested or object field properties

    For one-to-many relationships, unroll an array property to split its elements into multiple rows.

    property[*].sub-property

    Scenario 3: Split an array property into multiple rows

    Merge and deduplicate elements from a string array into a single property.

    property[]

    Scenario 4: Deduplicate and merge an array property

    Combine multiple properties into a single property.

    property1,property2

    Scenario 5: Multi-property merge

    Select the first non-null property from a list.

    property1|property2

    Scenario 6: Multi-property selection

Add a data source

Before you develop a synchronization task in DataWorks, you must add the required data source to DataWorks by following the instructions in Data source management. You can view parameter descriptions in the DataWorks console to understand the meanings of the parameters when you add a data source.

Data synchronization tasks

For information about the entry point for and the procedure of configuring a synchronization task, see the following configuration guides.

Offline synchronization task (single table)

Real-time write task (single table)

See Configure a real-time synchronization task in DataStudio (Legacy).

Full-database real-time synchronization

See Configure a real-time full-database synchronization task.

Appendix 1: Script demo and parameters

Configure a batch synchronization task by using the code editor

If you want to configure a batch synchronization task by using the code editor, you must configure the related parameters in the script based on the unified script format requirements. For more information, see Script mode configuration. The following information describes the parameters that you must configure for data sources when you configure a batch synchronization task by using the code editor.

Reader script demo

{
    "order":{
        "hops":[
            {
                "from":"Reader",
                "to":"Writer"
            }
        ]
    },
    "setting":{
        "errorLimit":{
            "record":"0" // The number of error records allowed.
        },
        "jvmOption":"",
        "speed":{
            "concurrent":3,
            "throttle":false
        }
    },
    "steps":[
        {
            "category":"reader",
            "name":"Reader",
            "parameter":{
                "column":[ // The columns to read.
                    "id",
                    "name"
                ],
                "endpoint":"http://es-cn-xxx.elasticsearch.aliyuncs.com:9200", // The endpoint.
                "index":"aliyun_es_xx",  // The index.
                "password":"*******",  // The password.
                "multiThread":true,
                "scroll":"5m",  // The scroll context duration.
                "pageSize":5000,
                "connTimeOut":600000,
                "readTimeOut":600000,
                "retryCount":30,
                "retrySleepTime":"10000",
                "search":{
                            "range":{
                                "gmt_modified":{
                                    "gte":0
                                }
                            }
                        },  // Query parameter. The content is identical to the query body of the Elasticsearch _search API.
                "type":"doc",
                "username":"aliyun_di"  // The username.
            },
            "stepType":"elasticsearch"
        },
        {
            "category":"writer",
            "name":"Writer",
            "parameter":{ },
            "stepType":"stream"
        }
    ],
    "type":"job",
    "version":"2.0" // The version number.
}

Reader script parameters

Parameter

Description

Required

Default

datasource

The name of an existing DataWorks data source.

Yes

None

index

The name of the index in Elasticsearch.

Yes

None

type

The type name of an index in Elasticsearch.

No

Index name

search

The query body for Elasticsearch.

Yes

None

pageSize

The number of records to read per page.

No

100

scroll

Specifies how long to keep the Elasticsearch scroll context alive for pagination.

  • Setting this value too low can cause the scroll context to expire during long intervals between page reads, resulting in data loss.

  • If you set this value too high, a query error may occur if concurrent queries exceed the server's max_open_scroll_context limit.

Yes

None

strictMode

Specifies whether to enable strict mode. If set to true, the read task stops on a shard.failed error to prevent reading partial data.

No

true

sort

The field by which to sort the results.

No

None

retryCount

The number of times to retry a failed operation.

No

30

connTimeOut

The client connection timeout, in milliseconds.

No

600,000

readTimeOut

The client read timeout, in milliseconds.

No

600,000

multiThread

Specifies whether to use multiple threads for HTTP requests.

No

true

preemptiveAuth

Specifies whether to use preemptive authentication for HTTP requests.

No

false

retrySleepTime

The interval between retries, in milliseconds.

No

10,000

discovery

Specifies whether to enable node discovery.

  • true: The client connects to a random node in the cluster, periodically refreshing the server list and sending requests to discovered nodes.

  • false: Sends requests only to the configured endpoint.

No

false

compression

Specifies whether to use GZIP to compress the request body. If you use GZIP, you must enable the http.compression setting on the Elasticsearch node.

No

false

dateFormat

If a field to be synchronized is of the date type and the field mapping does not specify a format, you must configure the dateFormat parameter. This configuration must include all formats of the date type fields to be synchronized. Example: "dateFormat" : "yyyy-MM-dd||yyyy-MM-dd HH:mm:ss".

No

None

full

Specifies whether to synchronize the entire document content as a single field to the destination. For more information, see Scenario 1: Full data pull.

No

None

multi

An advanced feature with five use cases. It has two sub-properties: multi.key and multi.mult. For more information, see the table in Advanced features.

No

None

Writer script demo

{
    "order": {
        "hops": [
            {
                "from": "Reader",
                "to": "Writer"
            }
        ]
    },
    "setting": {
        "errorLimit": {
            "record": "0"
        },
        "speed": {
            "throttle":true, // If throttle is false, the mbps parameter is ignored and throttling is disabled. If throttle is true, throttling is enabled.
            "concurrent":1, // The job concurrency.
            "mbps":"12" // The maximum rate in Mbps (1 Mbps = 1 MB/s).
        }
    },
    "steps": [
        {
            "category": "reader",
            "name": "Reader",
            "parameter": {

            },
            "stepType": "stream"
        },
        {
            "category": "writer",
            "name": "Writer",
            "parameter": {
                "datasource":"xxx",
                "index": "test-1",
                "type": "default",
                "cleanup": true,
                "settings": {
                        "number_of_shards": 1,
                        "number_of_replicas": 0
                },
                "discovery": false,
                "primaryKeyInfo":{
                    "type":"pk",    
                     "fieldDelimiter":",",
                     "column":[]
                    },
                "batchSize": 1000,
                "dynamic":false,
                "esPartitionColumn":[
                    {
                        "name":"col1",  
                        "comment":"xx", 
                        "type":"STRING" 
                        }
                     ],
                "column": [
                    {
                        "name": "pk",
                        "type": "id"
                    },
                    {
                        "name": "col_ip",
                        "type": "ip"
                    },
                    {
                        "name": "col_array",
                        "type": "long",
                        "array": true
                    },
                    {
                        "name": "col_double",
                        "type": "double"
                    },
                    {
                        "name": "col_long",
                        "type": "long"
                    },
                    {
                        "name": "col_integer",
                        "type": "integer"
                    },
                    {
                        "name": "col_keyword",
                        "type": "keyword"
                    },
                    {
                        "name": "col_text",
                        "type": "text",
                        "analyzer": "ik_max_word",
                        "other_params":
                            {
                                "doc_values": false
                            }
                    },
                    {
                        "name": "col_geo_point",
                        "type": "geo_point"
                    },
                    {
                        "name": "col_date",
                        "type": "date",
                        "format": "yyyy-MM-dd HH:mm:ss"
                    },
                    {
                        "name": "col_nested1",
                        "type": "nested"
                    },
                    {
                        "name": "col_nested2",
                        "type": "nested"
                    },
                    {
                        "name": "col_object1",
                        "type": "object"
                    },
                    {
                        "name": "col_object2",
                        "type": "object"
                    },
                    {
                        "name": "col_integer_array",
                        "type": "integer",
                        "array": true
                    },
                    {
                        "name": "col_geo_shape",
                        "type": "geo_shape",
                        "tree": "quadtree",
                        "precision": "10m"
                    }
                ]
            },
            "stepType": "elasticsearch"
        }
    ],
    "type": "job",
    "version": "2.0"
}
Note

An Elasticsearch instance in a VPC environment may be unreachable from the default resource group. To ensure connectivity for data synchronization, you must use a serverless resource group (recommended) or an exclusive resource group for Data Integration to connect to the VPC. For more information about how to add resource groups, see Serverless resource group.

Writer script parameters

Parameter

Description

Required

Default

datasource

The name of the Elasticsearch data source. If the data source does not exist in DataWorks, create one first. For more information, see Configure an Elasticsearch data source.

Yes

None

index

The name of the index in Elasticsearch.

Yes

None

type

The type of the index in Elasticsearch.

No

default

cleanup

Specifies whether to delete and recreate the target index before writing.

  • true: Deletes and recreates the index before writing, removing all existing data.

  • false: Retains existing data in the index.

No

false

batchSize

The number of documents per batch write to Elasticsearch.

No

1,000

trySize

The number of retries after a failed write to Elasticsearch.

No

30

timeout

The client timeout period.

No

600,000

discovery

Specifies whether to enable node discovery for the task.

  • true: Connects to a random node in the cluster. When node discovery is enabled, the client polls and periodically refreshes the server list.

  • false: The client connects only to the endpoints configured in the data source.

No

false

compression

Specifies whether to enable compression for HTTP requests.

No

true

multiThread

Specifies whether to use multiple threads for HTTP requests.

No

true

ignoreWriteError

Specifies whether to ignore write errors. If set to true, the system skips the failed operation and continues writing subsequent data.

No

false

ignoreParseError

Specifies whether to ignore data format parsing errors and continue writing subsequent data.

No

true

alias

An Elasticsearch alias works like a database view. For example, if you create an alias named my_index_alias for the index my_index, operations on my_index_alias apply to my_index.

If configured, an alias is created for the specified index after data import completes.

No

None

aliasMode

The alias mode after data import completes. Valid values are append and exclusive.

  • If aliasMode is set to append, the current index is added to the alias mapping. An alias can map to multiple indexes.

  • If aliasMode is set to exclusive, the existing alias is removed, and then the current index is added to the alias mapping. An alias can map to only one index.

The system resolves the alias to the actual index name. You can use aliases for index migration, unified queries across multiple indexes, and to implement view-like functionality.

No

append

settings

The index creation settings, in the same format as official Elasticsearch settings.

No

None

column

The column parameter configures the fields in a document. For each field, you can set basic properties such as name and type, and advanced properties such as Analyzer, Format, and Array.

The following field types are supported by Elasticsearch:

- id  // The id type maps to _id in Elasticsearch and can be considered a unique primary key. When writing data, documents with the same id overwrite each other and are not indexed.
- string
- text
- keyword
- long
- integer
- short
- byte
- double
- float
- date
- boolean
- binary
- integer_range
- float_range
- long_range
- double_range
- date_range
- geo_point
- geo_shape
- ip
- token_count
- array
- object
- nested

Notes on column types:

  • For a text type column, you can configure parameters such as analyzer, norms, and index_options. Example:

    {
        "name": "col_text",
        "type": "text",
        "analyzer": "ik_max_word"
        }
  • For a date type column, you can use one of the following methods to parse source data. Use the same method consistently.

    • Method 1: Write the field value from the reader directly to the es data field.

      • Set origin:true. This is required to write the raw field value directly to es data.

      • Configure "format" to indicate that when you create a mapping by using es writer, the format property must be set for this field. The following is an example:

          {
             "parameter":{
               "column":[{
                   "name": "col_date",
                   "type": "date",
                   "format": "yyyy-MM-dd HH:mm:ss",
                   "origin": true
                }]
           }
        }
    • Method 2 (Timezone conversion): If you want Data Integration to convert timezones, add the Timezone parameter.

      The configured "format" specifies the time format that Data Integration uses for parsing during the timezone conversion. Example:

        {
           "parameter" :{
             "column": [{
                "name": "col_date",
                "type": "date",
                "format": "yyyy-MM-dd HH:mm:ss",
               "Timezone": "UTC"
             }]
         }
      }
  • For a column of the geo_shape type, you can configure the tree (geohash or quadtree) and precision attributes. Example:

    {
        "name": "col_geo_shape",
        "type": "geo_shape",
        "tree": "quadtree",
        "precision": "10m"
        }

To configure Elasticsearch attributes other than type for a field in column, use the other_params parameter. When you update mappings, this parameter describes the other Elasticsearch attributes of the field.

 {
   "name": "guid",
   "other_params":
    {
       "doc_values": false
      },
    "type": "text"
  }

If you want to write source data to Elasticsearch as an array, you can parse the source data in JSON format or by using a specified delimiter. For more information, see Appendix 2: Write data to Elasticsearch as an array.

Yes

None

dynamic

Specifies whether to use Elasticsearch dynamic mapping to automatically add mappings for new fields in a document.

  • true: Retains the automatic mapping behavior of Elasticsearch.

  • false: The default value. Elasticsearch mappings are generated and updated based on the column configuration of the synchronization task.

The default type in Elasticsearch 7.x is _doc. If you use automatic mappings, set the type to _doc and esVersion to 7.

You must switch to script mode and add the version parameter: "esVersion": "7".

Important

If you encounter field mapping errors, you can enable this parameter to try to resolve the issue. However, this may cause field types to become inconsistent with your expectations or lead to data anomalies. Assess the risks for your data structure before enabling it.

No

false

actionType

Specifies the write action type. Valid values are index and update:

  • index: Internally uses the Index.Builder from the Elasticsearch SDK to construct batch requests. When you use the Elasticsearch index action to insert a document, it first checks whether an ID is specified in the document data:

    • If no ID is specified, Elasticsearch generates a unique ID and adds the document.

    • If an ID is specified, Elasticsearch replaces the entire document. It does not support updating only specific fields.

      Note

      This update operation is not the same as a partial update in Elasticsearch.

  • update: Updates a document based on a user-specified ID. If the ID does not exist in the index, a new document is inserted. If the ID exists, the operation updates the specified column fields and leaves other document fields unchanged. Each update operation retrieves the entire document to modify specific fields. This update operation does not support conditional filtering and performs updates only based on the specified ID. Because each update requires retrieving the original document, this operation may have a significant impact on performance.

    Note

    If you set the action type to update, you must configure the primaryKeyInfo parameter.

No

index

primaryKeyInfo

Specifies how to determine the document primary key in Elasticsearch.

  • Business Primary Key (pk): The _id value is set to the value of a specific field.

    "parameter":{
    "primaryKeyInfo":{
    "type":"pk",
    "column":["id"]}
    }
  • Composite Primary Key (specific): The _id value is a concatenation of the values of multiple fields, separated by the delimiter specified by Primary Key Delimiter.

    Note

    The field names are the fields to be written by the writer. In the codeless UI, the Configure Primary Key Columns lists only the fields that already exist in the Elasticsearch index.

    "parameter":{
    "primaryKeyInfo":{
    "type":"specific",
    "fieldDelimiter":",",
    "column":["col1","col2"]}
    }
  • No Primary Key (nopk): The _id is automatically generated by the system when data is written to Elasticsearch.

    "primaryKeyInfo":{
    "type":"nopk"
    }

Yes

specific

esPartitionColumn

Specifies whether to enable partitioned writes by setting the Elasticsearch routing parameter.

  • Enable partitioning: The values of the specified columns are concatenated without a delimiter, and the result is used as the routing value. When writing data, the system inserts or updates documents in the specified shard. If you enable partitioning, you must specify the partition columns.

    {    "esPartitionColumn": [
            {
                "name":"col1",
                "comment":"xx",
                "type":"STRING"
                }
            ],
        }
  • If you do not configure this parameter, _id is used for routing by default, which helps distribute documents evenly and prevent data skew.

No

false

enableWriteNull

Specifies whether to write null fields from the source to Elasticsearch. Valid values:

  • true: Writes null fields. After synchronization, the value of the corresponding field in Elasticsearch is null.

  • false: Does not write null fields. The field does not appear in the Elasticsearch document.

No

true

Appendix 2: Writing arrays to Elasticsearch

You can write source data to Elasticsearch as an array using one of two methods.

  • Parse data in JSON format

    For example, if the source data is "[1,2,3,4,5]", parse the data by setting json_array=true. It is then written to Elasticsearch as an array.

    "parameter" : {
      {
        "name":"docs_1",
        "type":"keyword",
        "json_array":true
      }
    }
  • Parse data using a delimiter

    For example, if the source data is "1,2,3,4,5", parse the data by setting splitter=",". It is then written to Elasticsearch as an array.

    Note

    A task supports only one delimiter because the splitter parameter is global for the task. You therefore cannot configure different delimiters for multiple array fields. For example, if your source data contains the columns col1="1,2,3,4,5" and col2="6-7-8-9-10", you cannot configure a separate delimiter for each column.

    "parameter" : {
          "column": [
            {
              "name": "docs_2",
              "array": true,
              "type": "long"
            }
          ],
          "splitter":","// Note: The splitter parameter must be at the same level as the column parameter.
    }

Appendix 3: Scenario examples

Scenario 1: Full data pull

  • Background: Pulls an entire Elasticsearch document into a single field.

  • Example configuration:

    
    ## reader: Original data in Elasticsearch
    "hits": [
        {
            "_index": "mutiltest_1",
            "_type": "_doc",
            "_id": "IXgdO4MB4GR_1DmrjTXP",
            "_score": 1.0,
            "_source": {
                "feature1": "value1",
                "feature2": "value2",
                "feature3": "value3"
            }
        }]
    
    ## Data Integration Elasticsearch reader configuration
    "parameter": {
      "column": [
          "content"
      ],
      "full":true
    }
    
    ## writer result: Writes one row and one column to the destination.
    {"_index":"mutiltest_1","_type":"_doc","_id":"IXgdO4MB4GR_1DmrjTXP","_source":{"feature1":"value1","feature2":"value2","feature3":"value3"},"sort":["IXgdO4MB4GR_1DmrjTXP"]}

Scenario 2: Synchronize nested or object field properties

  • Background: Uses a path to access properties of an object or nested field.

  • Syntax:

    • property

    • property.sub-property

    • property[0].sub-property

  • Code editor configuration:

    "multi":{
        "multi":true
    }
    Note

    This feature is not supported in the codeless UI.

  • Example configuration:

    ## reader: Original data in Elasticsearch
    "hits": [
        {
            "_index": "mutiltest_1",
            "_type": "_doc",
            "_id": "7XAOOoMB4GR_1Dmrrust",
            "_score": 1.0,
            "_source": {
                "level1": {
                    "level2": [
                        {
                            "level3": "testlevel3_1"
                        },
                        {
                            "level3": "testlevel3_2"
                        }
                    ]
                }
            }
        }
    ]
    ## Data Integration Elasticsearch reader configuration
    "parameter": {
      "column": [
          "level1",
          "level1.level2",
          "level1.level2[0]",
          "level1.level2.level3"
      ],
      "multi":{
            "multi":true
        }
    }
    
    ## writer result: 1 row, 4 columns
    column1(level1):            {"level2":[{"level3":"testlevel3_1"},{"level3":"testlevel3_2"}]}
    column2(level1.level2):     [{"level3":"testlevel3_1"},{"level3":"testlevel3_2"}]
    column3(level1.level2[0]):  {"level3":"testlevel3_1"}
    column4(level1.level2.level3):  null
    Note
    • If an ancestor node in the path is an array, the result is null. For example, retrieving level1.level2.level3 returns null because level2 is an array. To access the property, you must specify an index, such as level1.level2[0].level3 or level1.level2[1].level3. The wildcard syntax level1.level2[*].level3 is not supported.

    • Keys that contain a period (.) are not supported. For example, if the data is {"level1.level2":{"level3":"testlevel3_1"}}, the result is null.

Scenario 3: Split an array property into multiple rows

  • Background: For one-to-many relationships, you can unroll an array by splitting each element into a separate row.

  • Syntax: property[*].sub-property

  • Example effect: Source data such as { "splitKey": [1, 2, 3, 4, 5] } is transformed into five rows, with each row containing one element from the array.

  • Code editor configuration:

    "multi":{   
           "multi":true,    
            "key": "headers"
    }
    Note
    • In the codeless UI, you can set the split multi-row array column name parameter to achieve the same effect by automatically generating the corresponding script configuration.

    • The value of the property specified by key must be a list. Otherwise, an error occurs.

  • Example configuration:

    ## reader: Original data in Elasticsearch
    [
        {
            "_index": "lmtestjson",
            "_type": "_doc",
            "_id": "nhxmIYMBKDL4VkVLyXRN",
            "_score": 1.0,
            "_source": {
                "headers": [
                    {
                        "remoteip": "192.0.2.1"
                    },
                    {
                        "remoteip": "192.0.2.2"
                    }
                ]
            }
        },
        {
            "_index": "lmtestjson",
            "_type": "_doc",
            "_id": "wRxsIYMBKDL4VkVLcXqf",
            "_score": 1.0,
            "_source": {
                "headers": [
                    {
                        "remoteip": "192.0.2.3"
                    },
                    {
                        "remoteip": "192.0.2.4"
                    }
                ]
            }
        }
    ]
    ## Data Integration Elasticsearch reader configuration
    {
       "column":[
          "headers[*].remoteip"
      ]
      "multi":{
          "multi":true,
          "key": "headers"
      }
    }
    
    ## writer result: 4 rows
    192.0.2.1
    192.0.2.2
    192.0.2.3
    192.0.2.4

Scenario 4: Deduplicate and merge array properties

  • Background: Deduplicates array elements and merges them into a comma-separated string. This also works with sub-properties such as name1.name2. Deduplication is based on the toString() result of each element.

  • Syntax: property[].

    Including [] in the column name triggers this deduplication and merge operation.

  • Code editor configuration:

    "multi":{
        "multi":true
    }
    Note

    This feature is not supported in the codeless UI.

  • Example configuration:

    ## reader: Original data in Elasticsearch
    "hits": [
    {
        "_index": "mutiltest_1",
        "_type": "_doc",
        "_id": "4nbUOoMB4GR_1Dmryj8O",
        "_score": 1.0,
        "_source": {
            "feature1": [
                "value1",
                "value1",
                "value2",
                "value2",
                "value3"
            ]
        }
    }
    ]
    ## Data Integration Elasticsearch reader configuration
    "parameter": {
      "column":[
            "feature1[]"
      ],
      "multi":{
            "multi":true
        }
    }
    
    ## writer result: 1 row, 1 column
    "value1,value2,value3"

Scenario 5: Selectively synchronize multiple properties

  • Background: Returns the first non-null property value from a specified list. If all properties are null or absent, null is returned.

  • Syntax: property1|property2|...

    Including the pipe (|) character in the column name triggers this multi-property selection.

  • Code editor configuration:

    "multi":{    
        "multi":true
    }
    Note

    This feature is not supported in the codeless UI.

  • Example configuration:

    ## reader: Original data in Elasticsearch
    "hits": [
        {
            "_index": "mutiltest_1",
            "_type": "_doc",
            "_id": "v3ShOoMB4GR_1DmrZN22",
            "_score": 1.0,
            "_source": {
                "feature1": "feature1",
                "feature2": [
                    1,
                    2,
                    3
                ],
                "feature3": {
                    "child": "feature3"
                }
            }
        }]
    
    ## Data Integration Elasticsearch reader configuration
    "parameter": {
      "column":[
            "feature1|feature2|feature3"
      ],
      "multi":{
            "multi":true
        }
    }
    
    ## writer result: 1 row, 1 column
    "feature1"

Scenario 6: Merge and sync multiple properties

  • Background: Concatenates multiple property values into a single comma-separated string.

  • Syntax: property1,property2,...

    Including a comma (,) in the column name triggers this multi-property merge operation.

  • Code editor configuration:

    "multi":{
        "multi":true
    }
    Note

    This feature is not supported in the codeless UI.

  • Example configuration:

    ## reader: Original data in Elasticsearch
    "hits": [
        {
            "_index": "mutiltest_1",
            "_type": "_doc",
            "_id": "v3ShOoMB4GR_1DmrZN22",
            "_score": 1.0,
            "_source": {
                "feature1": "feature1",
                "feature2": [
                    1,
                    2,
                    3
                ],
                "feature3": {
                    "child": "feature3"
                }
            }
        }]
    ## Data Integration Elasticsearch reader configuration
    "parameter": {
      "column":[
            "feature1,feature2,feature3"
      ],
      "multi":{
            "multi":true
        }
    }
    
    ## writer result: 1 row, 1 column
    "feature1,[1,2,3],{\"child\":\"feature3\"}"

References

Data Integration supports many other data sources. For a complete list, see Supported data sources and synchronization solutions.