Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
  • Blog
  • Pricing
  • Documentation
Yandex project
© 2025 Yandex.Cloud LLC
Yandex Data Transfer
  • Available transfers
  • Getting started
    • All guides
    • Preparing for a transfer
      • Managing endpoints
      • Migrating endpoints to a different availability zone
        • Source
        • Target
    • Managing transfer process
    • Working with databases during transfer
    • Monitoring transfer status
  • Troubleshooting
  • Access management
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Public materials

In this article:

  • Scenarios for transferring data to Elasticsearch
  • Configuring the data source
  • Preparing the target database
  • Configuring the Elasticsearch target endpoint
  • Custom installation
  • Additional settings
  • Troubleshooting data transfer issues
  • Transfer failure
  • Document duplication on the target
  1. Step-by-step guides
  2. Configuring endpoints
  3. Elasticsearch
  4. Target

Transferring data to an Elasticsearch target endpoint

Written by
Yandex Cloud
Updated at April 24, 2025
  • Scenarios for transferring data to Elasticsearch
  • Configuring the data source
  • Preparing the target database
  • Configuring the Elasticsearch target endpoint
    • Custom installation
    • Additional settings
  • Troubleshooting data transfer issues
    • Transfer failure
    • Document duplication on the target

Yandex Data Transfer enables you to migrate data to a Elasticsearch database and implement various data transfer, processing, and transformation scenarios. To implement a transfer:

  1. Explore possible data transfer scenarios.
  2. Configure one of the supported data sources.
  3. Prepare the Elasticsearch database for the transfer.
  4. Configure the target endpoint in Yandex Data Transfer.
  5. Create a transfer and start it.
  6. Perform required operations with the database and control the transfer.
  7. In case of any issues, use ready-made solutions to resolve them.

Scenarios for transferring data to ElasticsearchScenarios for transferring data to Elasticsearch

  1. Migration: Moving data from one storage to another. Migration often means migrating a database from obsolete local databases to managed cloud ones.

Configuring the data sourceConfiguring the data source

Configure one of the supported data sources:

  • Apache Kafka®
  • YDS
  • PostgreSQL
  • Elasticsearch
  • OpenSearch

For a complete list of supported sources and targets in Yandex Data Transfer, see Available transfers.

Preparing the target databasePreparing the target database

Elasticsearch
  • If not planning to use Cloud Interconnect or VPN for connections to an external cluster, make such cluster accessible from the Internet from IP addresses used by Data Transfer.

    For details on linking your network up with external resources, see this concept.

  • Make sure the number of columns in the source does not exceed the maximum number of fields in Elasticsearch indexes. The maximum number of fields is provided in the index.mapping.total_fields.limit parameter; the default value is 1000.

    To increase the parameter value, set up a template that makes the maximum number of fields in new indexes equal to the specified value.

    Sample template setup request
    curl \
        --user <Elasticsearch_username>:<password> \
        --header 'Content-Type: application/json' \
        --request PUT "https://<Elasticsearch_cluster_FQDN>:9200/_template/index_defaults" \
        --data '
            {
                "index_patterns": "cdc*",
                "settings": {
                    "index": {
                        "mapping": {
                            "total_fields": {
                                "limit": "2000"
                            }
                        }
                    }
                }
            }'
    

    With this template setup, all new indexes with the cdc* mask may contain up to 2000 fields.

    You can also set up templates using the Kibana interface.

    To check the current index.mapping.total_fields.limit parameter value, use the Kibana interface or execute the following request:

    curl \
        --user <Elasticsearch_username>:<password> \
        --header 'Content-Type: application/json' \
        --request GET 'https://<Elasticsearch_cluster_FQDN>:9200/<index_name>/_settings/*total_fields.limit?include_defaults=true'
    
  • By default, when transferring data to a single index, only one host is used. To distribute the load across hosts when transferring large amounts of data, set up a template to split new indexes into shards in advance.

    Sample template setup request
    curl \
        --user <Elasticsearch_username>:<password> \
        --header 'Content-Type: application/json' \
        --request PUT 'https://<Elasticsearch_cluster_FQDN>:9200/_template/index_defaults' \
        --data '
            {
                "index_patterns": "cdc*",
                "settings" : {
                    "index" : {
                        "number_of_shards" : 15,
                        "number_of_replicas" : 1
                    }
                }
            }'
    

    With this template setup, all new indexes with the cdc* mask will be split into 15 shards.

    You can also set up templates using the Kibana interface.

Configuring the Elasticsearch target endpointConfiguring the Elasticsearch target endpoint

When creating or updating an endpoint, you can define:

  • custom installation settings, including those based on Yandex Compute Cloud VMs. These are required parameters.
  • Additional parameters.

Custom installationCustom installation

Connecting to nodes with explicitly specified network addresses and ports.

Management console
  • Data nodes: Click to add a new data node. For each node, specify:

    • Host: IP address or FQDN of the host with the DATA role you want to connect to.

    • Port: Port number Data Transfer will use for connections to the DATA host.

  • SSL: Select this option if a secure SSL connection is used.

  • CA certificate: Upload the certificate file or add its contents as text if you need to encrypt the data to transfer, e.g., to meet the PCI DSS requirements.

    Warning

    If no certificate is added, the transfer may fail with an error.

  • Subnet ID: Select or create a subnet in the required availability zone.

    If the value in this field is specified for both endpoints, both subnets must be hosted in the same availability zone.

  • User: Specify the username Data Transfer will use to connect to the cluster.

  • Password: Enter the user password to the cluster.

  • Security groups: Select the cloud network to host the endpoint and security groups for network traffic.

    Thus, you will be able to apply the specified security group rules to the VMs and clusters in the selected network without changing the settings of these VMs and clusters. For more information, see Networking in Yandex Data Transfer.

Additional settingsAdditional settings

Management console
  • Cleanup policy: Select a way to clean up data in the target database before the transfer:

    • Don't cleanup: Select this option if you are only going to do replication without copying data.

    • Drop: Completely delete the tables included in the transfer (default).

      Use this option to always transfer the latest version of the table schema to the target database from the source whenever the transfer is activated.

  • Sanitize documents keys: Use this option to automatically replace keys that are not valid for Elasticsearch in the target fields.

    The autocorrect rules are as follows:

    • Empty keys or keys consisting of spaces and periods will be replaced with underscores: "", " ", "." → "_".
    • Leading and trailing periods will be removed: "somekey.", ".somekey" → "somekey".
    • If there are two periods in a row or there is nothing but spaces between them, the entire fragment will be replaced with a period: " some . . key" → " some . key".

    Here is an example of how the autocorrect works: ". s o m e ..incorrect....key. . . " → " s o m e .incorrect.key".

After configuring the data source and target, create and start the transfer.

Troubleshooting data transfer issuesTroubleshooting data transfer issues

  • Transfer failure
  • Document duplication on the target

For more troubleshooting tips, see Troubleshooting.

Transfer failureTransfer failure

Error messages:

object field starting or ending with a [.] makes object resolution ambiguous <field_description>

Index -1 out of bounds for length 0

The transfer is aborted because the keys in the documents being transferred are not valid for the Elasticsearch target. Invalid keys are empty keys and keys that:

  • Consist of spaces.
  • Consist of periods.
  • Have a period at the beginning or end.
  • Have two or more periods in a row.
  • Include periods separated by spaces.

Solution:

In the target endpoint additional settings, enable Sanitize documents keys and reactivate the transfer.

Document duplication on the targetDocument duplication on the target

When repeatedly transferring data, documents get duplicated on the target.

All documents transferred from the same source table fall under the same index named <schemaName.tableName> on the target. In this case, the target automatically generates document IDs (_id) by default. As a result, identical documents are assigned different IDs and get duplicated.

There is no duplication if the primary keys are specified in the source table or endpoint conversion rules. Document IDs are then generated at the transfer stage using the primary key values.

Generation is performed as follows:

  1. If the key value contains a period (.), it is escaped with \: some.key --> some\.key.
  2. All the primary key values are converted into a string: <some_key1>.<some_key2>.<...>.
  3. The resulting string is converted by the url.QueryEscape function.
  4. If the length of the resulting string does not exceed 512 characters, it is used as the _id. If it is longer than 512 characters, it is hashed with SHA-1 and the resulting hash is used as the _id.

As a result, documents with the same primary keys will receive the same ID when the data is transferred again, and the document transferred last will overwrite the existing one.

Solution:

  1. Set the primary key for one or more columns in the source table or in the endpoint conversion rules.
  2. Run the transfer.

Was the article helpful?

Previous
Source
Next
Source
Yandex project
© 2025 Yandex.Cloud LLC