Elasticsearch Service Sink Connector for Confluent Cloud

The fully-managed Elasticsearch Service Sink connector for Confluent Cloud moves data from Apache Kafka® to Elasticsearch. The connector supports Avro, JSON Schema, Protobuf, or JSON (schemaless) data output from Apache Kafka® topics. It writes data from a topic in Kafka to an Elasticsearch index. Elasticsearch is often used for text queries, analytics, and as a key-value store.

The connector supports both the analytics and key-value store use cases. For the analytics use case, each message in Kafka is treated as an event and the connector uses topic+partition+offset as a unique identifier for events, which are then converted to unique documents in Elasticsearch.

For the key-value store use case, the connector supports using keys from Kafka messages as document IDs in Elasticsearch, while providing configurations that ensure updates to a key are written to Elasticsearch in order. For both use cases, Elasticsearch’s idempotent write semantics guarantees exactly once delivery.

All data for a topic have the same type in Elasticsearch. This allows an independent evolution of schemas for data from different topics. This simplifies schema evolution because Elasticsearch has one enforcement on mappings; that is, all fields with the same name in the same index must have the same mapping type. By default, index in Elasticsearch is named same as the topic name.

Note

Features

The Elasticsearch Service Sink connector inserts Kafka records into an Elasticsearch index (it supports inserts only).

The connector provides the following features:

  • Database authentication: Uses Username and password authentication.

  • Input data formats: The connector supports Avro, JSON Schema, Protobuf, or JSON (schemaless) input data formats. Schema Registry must be enabled to use a Schema Registry-based format (for example, Avro, JSON_SR (JSON Schema), or Protobuf). See Schema Registry Enabled Environments for additional information.

  • Select configuration properties: Provides several optional configuration properties that allow you to fine-tune the connector’s behavior and performance. These properties are described below:

    • key.ignore: Whether to ignore the record key for the purpose of forming the Elasticsearch document ID. When this is set to true, document IDs are created from the topic name, partition, and offset (i.e., topic+partition+offset).

    • schema.ignore: Whether to ignore schemas during indexing. When this property is set to true, the record schema is ignored and Elasticsearch infers the mapping from the data. For this to work, Elasticsearch dynamic mapping must be enabled.

    • compact.map.entries: Defines how map entries with string keys in record values should be written to JSON. When this property is set to true, the entries are written compactly as `"entryKey": "entryValue". Otherwise, map entries with string keys are written as a nested document ({"key": "entryKey", "value": "entryValue"}).

    • behavior.on.null.values: How to handle records with a non-null key and a null value (i.e., Kafka tombstone records). Valid options are ignore, delete, and fail. Defaults to ignore.

    • drop.invalid.message: Whether to drop a Kafka message when it cannot be converted to an output message. Defaults to false.

    • batch.size: The number of records to process as a batch when writing to Elasticsearch. This value defaults to 2000.

    • linger.ms: Linger time in milliseconds for batching. Records that arrive in between request transmissions are batched into a single bulk indexing request, based on the batch.size configuration. Normally this only occurs under load, when records arrive faster than they can be sent out. However, you may want to reduce the number of requests under light load to get the benefits from bulk indexing. In other words, when a pending batch is not full, rather than immediately sending it out the task waits up to the given delay. This allows other records to be added so that they can be batched into a single request. This value defaults to 1000 ms (1 second).

    • flush.timeout.ms: The timeout in milliseconds to use for periodic flushing and waiting for buffer space to be made available by completed requests, as records are added. If this timeout is exceeded the task fails. This value defaults to 10000 ms.

    • connection.compression: Whether to use Gzip compression on the HTTP connection to ElasticSearch. To make this setting work the http.compression setting must be set to true on the Elasticsearch nodes. For more information about the Elasticsearch HTTP properties, see Elasticsearch HTTP Settings. Defaults to false.

    • data.stream.type: Describes the generic type of data to be written to a data stream. Allowed values include logs, metrics, none, and any custom index templates from the destination cluster. When set, it will be used in conjunction with data.stream.dataset to construct the data stream name in the form of {data.stream.type}-{data.stream.dataset}-{data.stream.namespace}. The default is none, which directs the connector to write to regular indices.

  • Topic Mutating SMTs Support: The connector also supports the following SMTs:

    • org.apache.kafka.connect.transforms.TimestampRouter

    • io.confluent.connect.transforms.MessageTimestampRouter

    • io.confluent.connect.transforms.ExtractTopic

    • io.confluent.connect.cloud.transforms.TopicRegexRouter

    For details, see the Single Message Transformations (SMT) documentation.

  • Alias Support: The connector supports writing to aliases for both indices and data streams. These aliases must be pre-created in Elasticsearch.

  • Supports External topic to resource mapping: The connector supports external topic to resource mapping, allowing to map Kafka topics to user-defined Elasticsearch resources and write to pre-created indices, data streams, and aliases. It is useful for custom naming schemes and integrating with existing Elasticsearch resources. All resources referenced via topic.to.external.resource.mapping (whether index, data stream, or alias) must exist before the connector starts. Each Kafka topic must map to just one Elasticsearch resource; many-to-one or one-to-many mappings aren’t supported.

For more information and examples to use with the Confluent Cloud API for Connect, see the Confluent Cloud API for Connect Usage Examples section.

Limitations

Be sure to review the following information.

Quick Start

Use this quick start to get up and running with the Confluent Cloud Elasticsearch Service Sink connector. The quick start provides the basics of selecting the connector and configuring it to stream events to an Elasticsearch deployment.

Note

The connector only works with the Elasticsearch Service from Elastic Cloud.

Prerequisites

  • Authorized access to a Confluent Cloud cluster on Amazon Web Services (AWS), Microsoft Azure (Azure), or Google Cloud.

  • The Confluent CLI installed and configured for the cluster. See Install the Confluent CLI.

  • Schema Registry must be enabled to use a Schema Registry-based format (for example, Avro, JSON_SR (JSON Schema), or Protobuf). See Schema Registry Enabled Environments for additional information.

  • For networking considerations, see Networking and DNS. To use a set of public egress IP addresses, see Public Egress IP Addresses for Confluent Cloud Connectors.

  • The Elasticsearch Service deployment must be in the same region as your Confluent Cloud deployment.

  • You add a valid Elasticsearch Service username and password to the connector configuration. You get these when you create your Elastic deployment. An example is shown below:

    Elasticsearch Deployment username and password
  • The Elasticsearch Service Sink connector (user) must have the following privileges:

    • Cluster privileges: monitor, manage, and all

    • Index privileges: create_index, read, write, and view_index_metadata

  • Kafka cluster credentials. The following lists the different ways you can provide credentials.

    • Enter an existing service account resource ID.

    • Create a Confluent Cloud service account for the connector. Make sure to review the ACL entries required in the service account documentation. Some connectors have specific ACL requirements.

    • Create a Confluent Cloud API key and secret. To create a key and secret, you can use confluent api-key create or you can autogenerate the API key and secret directly in the Cloud Console when setting up the connector.

Using the Confluent Cloud Console

Step 1: Launch your Confluent Cloud cluster

To create and launch a Kafka cluster in Confluent Cloud, see Create a kafka cluster in Confluent Cloud.

Step 2: Add a connector

In the left navigation menu, click Connectors. If you already have connectors in your cluster, click + Add connector.

Step 3: Select your connector

Click the Elasticsearch Service Sink connector card.

Elasticsearch Service Sink Connector Card

Step 4: Enter the connector details

Note

  • Ensure you have all your prerequisites completed.

  • An asterisk ( * ) designates a required entry.

At the Add Elasticsearch Service Sink Connector screen, complete the following:

If you’ve already populated your Kafka topics, select the topics you want to connect from the Topics list.

To create a new topic, click +Add new topic.

  1. Select the way you want to provide Kafka Cluster credentials. You can choose one of the following options:

    • My account: This setting allows your connector to globally access everything that you have access to. With a user account, the connector uses an API key and secret to access the Kafka cluster. This option is not recommended for production.

    • Service account: This setting limits the access for your connector by using a service account. This option is recommended for production.

    • Use an existing API key: This setting allows you to specify an API key and a secret pair. You can use an existing pair or create a new one. This method is not recommended for production environments.

    Note

    Freight clusters support only service accounts for Kafka authentication.

  1. Click Continue.

  1. Enter your Elasticsearch connection details:

    • Connection URI: Elasticsearch Service connection URI.

    • Connection user: The username used to authenticate with Elasticsearch Service.

    • Connection password: The password used to authenticate with Elasticsearch Service.

    • Enable SSL Security: Sets authentication support. Set this to SSL if you want to enable PKI authentication with SSL support. If not set to SSL, the connector ignores all SSL configuration properties. Note that the connector will use SSL if HTTPS is used.

  2. Click Continue.

Note

Configuration properties that are not shown in the Cloud Console use the default values.See Configuration Properties for all property values and definitions.

  1. Select the Input Kafka record value (data coming from the Kafka topic): AVRO, JSON_SR (JSON Schema), PROTOBUF, or JSON (schemaless). A valid schema must be available in Schema Registry to use a schema-based message format (for example, AVRO, JSON_SR, or PROTOBUF). See Schema Registry Enabled Environments for additional information.

  2. External Resource Usage: Select the external resource that the connector writes to. Valid options are INDEX, DATASTREAM, ALIAS_INDEX, ALIAS_DATASTREAM, DISABLED. When set to DISABLED (default), the connector auto creates indices or datastreams based on topic name and datastream configuration.

  3. Data Stream Type: Applicable when External Resource Usage is set to DISABLED. Generic type describing the data to be written to data stream. It can be set to any custom index templates from the destination cluster. When set to NONE (default), the connector writes to regular indices. If set to LOGS or METRICS, this configuration is used with Data Stream Dataset to construct the data stream name in the form - {data.stream.type}-{data.stream.dataset}-{data.stream.namespace} ({data.stream.namespace} defaults to ${topic}).

  4. Data Stream Dataset: Applicable when External Resource Usage is set to DISABLED. Generic name describing data ingested and its structure to be written to a data stream. You can enter a lowercase string using a maximum of 100 characters. The string must not contain spaces or any of these special characters /\\*\"<>|,#:-. This configuration is used with Data Stream Type to construct the data stream name in the form of {data.stream.type}-{data.stream.dataset}-{data.stream.namespace} ({data.stream.namespace} defaults to ${topic}). If this property is left blank, the connector writes to regular indices.

  5. Data Stream Namepace: Applicable when External Resource Usage is set to DISABLED. Generic name describing a user-configurable arbitrary grouping for writing to a data stream. It can be any string up to 100 characters, in lowercase, without spaces or special characters (/*”<>|,#:-). If not set, the connector writes to regular indices. When set, it is used with Data Stream Type and Data Stream Dataset to form the data stream name in the format - {data.stream.type}-{data.stream.dataset}-{data.stream.namespace}. Default is ${topic}, which means the topic name.

  6. Data Stream Timestamp Field: Applicable when External Resource Usage is set to DISABLED, DATASTREAM or ALIAS_DATASTREAM. All documents sent to a data stream need a timestamp field with values of type date or data_nanos. Otherwise, the document won’t be sent.

  7. Topic to External Resource Mapping: Applicable when External Resource Usage is set to INDEX, DATASTREAM, ALIAS_INDEX or ALIAS_DATASTREAM. A list of topic-to-resource mappings in the format topic:resource. If specified, the connector uses the provided resource name (index, data stream, or alias) instead of the topic name for writing to Elasticsearch. The resource must exist in Elasticsearch before configuring the connector.The type of resource (index, data stream, or alias) is determined by the external.resource.usage configuration.

    Show advanced configurations
    • Schema context: Select a schema context to use for this connector, if using a schema-based data format. This property defaults to the Default context, which configures the connector to use the default schema set up for Schema Registry in your Confluent Cloud environment. A schema context allows you to use separate schemas (like schema sub-registries) tied to topics in different Kafka clusters that share the same Schema Registry environment. For example, if you select a non-default context, a Source connector uses only that schema context to register a schema and a Sink connector uses only that schema context to read from. For more information about setting up a schema context, see What are schema contexts and when should you use them?.

    • Key ignore: Whether to ignore the record key for the purpose of forming the Elasticsearch document ID. When this is set to true, document IDs are created from the topic name, partition, and offset (for example, topic+partition+offset).

    • Topics for ‘Ignore Key’ mode: A list of topics where the key is ignored when forming the Elasticsearch document ID. Used when Key ignore is set to true. If no topics are listed in this property, the connector ignores keys when processing all records.

    • Schema ignore: Whether to ignore schemas during indexing. When this property is set to true, the record schema is ignored and Elasticsearch infers the mapping from the data. For this to work, Elasticsearch dynamic mapping must be enabled. Note that this property must stay set to false (default) for JSON (schemaless).

    • Topics for ‘Ignore Schema’ mode: A list of topics where the record schema is ignored. Used when Schema ignore is set to true. If no topics are listed in this property, the connector ignores the schema when processing all records.

    • Compact map entries: Defines how map entries with string keys in record values should be written to JSON. When this property is set to true, the entries are written compactly as `"entryKey": "entryValue". Otherwise, map entries with string keys are written as a nested document ({"key": "entryKey","value": "entryValue"}).

    • Write Method: The method the connector uses to write data to Elasticsearch. Options are INSERT or UPSERT. When INSERT (the default) is used, the connector constructs a document from the record value and inserts the document into Elasticsearch, completely replacing any existing document with the same ID. When UPSERT is used, the connector creates a new document if one with the specified ID does not exist. If the document exists, the connector updates the document with the same ID by adding or replacing only those fields present in the record value. The UPSERT method may require additional Elasticsearch time and resources, so consider increasing the Read Timeout and decreasing the Batch size configuration properties.

    • Behavior on null values: How to handle records with a non-null key and a null value (for example, Kafka tombstone records). Options are delete, fail, and ignore (default).

    • Behavior on malformed documents: How to handle records that Elasticsearch rejects due to the following malformed document exception errors:

      • strict_dynamic_mapping_exception

      • mapper_parsing_exception

      • illegal_argument_exception

      • action_request_validation_exception

      ignore will skip records with these errors. fail will fail the connector.

      Note

      In case of other malformed document errors, the connector sends the records to the DLQ along with the exception and the connector fails, even if this property is set to ignore.

    • Drop invalid message: Whether to drop a Kafka message when it cannot be converted to an output message. Defaults to false.

    • Batch size: The number of records to process as a batch when writing to Elasticsearch. This value defaults to 2000.

    • Linger (ms): Linger time in milliseconds for batching. Records that arrive in between request transmissions are batched into a single bulk indexing request, based on the Batch size value. Normally this only occurs under load, when records arrive faster than they can be sent out. However, you may want to reduce the number of requests under light load, to get the benefits from bulk indexing. In other words, when a pending batch is not full, rather than immediately sending it out the task waits up to the given delay. This allows other records to be added so that they can be batched into a single request. This value defaults to 1000 ms (1 second).

    • Flush timeout (ms): The timeout in milliseconds to use for periodic flushing and waiting for buffer space to be made available by completed requests, as records are added. If this timeout is exceeded the task fails. This value defaults to 10000 ms.

    • Flush synchronously?: Sets whether or not flushes wait for background processing to finish. Defaults to true. This has a throughput penalty and makes the connector less responsive, but allows the use of topic-mutating SMTs (for example, RegexRouter or TimestampRouter).

    • Connection compression: Whether to use Gzip compression on the HTTP connection to ElasticSearch. To make this setting work the http.compression setting must be set to true on the Elasticsearch nodes. For more information about the Elasticsearch HTTP properties, see Elasticsearch HTTP Settings.

    • Read Timeout: How long to wait in milliseconds (ms) for the Elasticsearch server to send a response. The task fails if any read operation times out. Defaults to 15000 ms (15 seconds).

    Auto-restart policy

    • Enable Connector Auto-restart: Control the auto-restart behavior of the connector and its task in the event of user-actionable errors. Defaults to true, enabling the connector to automatically restart in case of user-actionable errors. Set this property to false to disable auto-restart for failed connectors. In such cases, you would need to manually restart the connector.

    Consumer configuration

    • Max poll interval(ms): Set the maximum delay between subsequent consume requests to Kafka. Use this property to improve connector performance in cases when the connector cannot send records to the sink system. The default is 300,000 milliseconds (5 minutes).

    • Max poll records: Set the maximum number of records to consume from Kafka in a single request. Use this property to improve connector performance in cases when the connector cannot send records to the sink system. The default is 500 records.

    Transforms

  8. Click Continue.

Based on the number of topic partitions you select, you will be provided with a recommended number of tasks.

  1. To change the number of recommended tasks, enter the number of tasks for the connector to use in the Tasks field.

  2. Click Continue.

  1. Verify the connection details.

  2. Click Launch.

    Launch the connector

    The status for the connector should go from Provisioning to Running.

    Connector running

Step 5: Check the results in Elasticsearch

Verify that new records are being added to your Elasticsearch deployment.

For more information and examples to use with the Confluent Cloud API for Connect, see the Confluent Cloud API for Connect Usage Examples section.

Tip

When you launch a connector, a Dead Letter Queue topic is automatically created. See View Connector Dead Letter Queue Errors in Confluent Cloud for details.

Using the Confluent CLI

Complete the following steps to set up and run the connector using the Confluent CLI.

Note

Make sure you have all your prerequisites completed.

Step 1: List the available connectors

Enter the following command to list available connectors:

confluent connect plugin list

Step 2: List the connector configuration properties

Enter the following command to show the connector configuration properties:

confluent connect plugin describe <connector-plugin-name>

The command output shows the required and optional configuration properties.

Step 3: Create the connector configuration file

Create a JSON file that contains the connector configuration properties. The following example shows required and optional connector properties.

{
  "connector.class": "ElasticsearchSink",
  "name": "elasticsearch-connector",
  "kafka.auth.mode": "KAFKA_API_KEY",
  "kafka.api.key": "<my-kafka-api-key",
  "kafka.api.secret": "<my-kafka-api-secret",
  "topics":  "<topic1>, <topic2>"
  "input.data.format": "JSON",
  "connection.url": "<elasticsearch-URI>",
  "connection.username": "<elasticsearch-username>",
  "connection.password": "<elasticsearch-password>",
  "type.name": "<type-name>",
  "key.ignore": "true",
  "schema.ignore": "true",
  "tasks.max": "1"
}

Note the following property definitions:

  • "connector.class": Identifies the connector plugin name.

  • "name": Sets a name for your new connector.

  • "kafka.auth.mode": Identifies the connector authentication mode you want to use. There are two options: SERVICE_ACCOUNT or KAFKA_API_KEY (the default). To use an API key and secret, specify the configuration properties kafka.api.key and kafka.api.secret, as shown in the example configuration (above). To use a service account, specify the Resource ID in the property kafka.service.account.id=<service-account-resource-ID>. To list the available service account resource IDs, use the following command:

    confluent iam service-account list
    

    For example:

    confluent iam service-account list
    
       Id     | Resource ID |       Name        |    Description
    +---------+-------------+-------------------+-------------------
       123456 | sa-l1r23m   | sa-1              | Service account 1
       789101 | sa-l4d56p   | sa-2              | Service account 2
    
  • "input.data.format": Sets the input Kafka record value format (data coming from the Kafka topic). Valid entries are AVRO, JSON_SR, PROTOBUF, or JSON. You must have Confluent Cloud Schema Registry configured if using a schema-based message format (for example, Avro, JSON_SR (JSON Schema), or Protobuf).

  • "connection.url": Enter the connection URI. This is the Elasticsearch endpoint you can copy from your Elasticsearch deployment console. The URI you enter should look like this: https://ec5bfac80bc14c26a77eefb6585f196c.us-west-2.aws.found.io:9243.

  • "connection.username" and "connection.password" Enter the Elasticsearch deployment username and password. An example showing where these are on the Elastic deployment console is shown in the prerequisites.

  • "type.name": This is a name that Elasticsearch uses when indexing and to divide documents into logical groups. This can be anything you choose (for example, customer or item). For more information about this property and mapping in general, see Elasticsearch Mapping: The Basics, Updates & Examples.

The following are optional properties you can include in the configuration:

  • key.ignore: Whether to ignore the record key for the purpose of forming the Elasticsearch document ID. When this is set to true, document IDs are created from the topic name, partition, and offset (i.e., topic+partition+offset). Defaults to false if not used.

  • schema.ignore: Whether to ignore schemas during indexing. When this property is set to true, the record schema is ignored and Elasticsearch infers the mapping from the data. For this to work, Elasticsearch dynamic mapping must be enabled. Defaults to false if not used.

  • compact.map.entries: Defines how map entries with string keys in record values should be written to JSON. When this property is set to true, the entries are written compactly as `"entryKey": "entryValue". Otherwise, map entries with string keys are written as a nested document ({"key": "entryKey", "value": "entryValue"}). Defaults to false if not used.

  • behavior.on.null.values: How to handle records with a non-null key and a null value (i.e., Kafka tombstone records). Valid options are ignore, delete, and fail. Defaults to ignore if not used.

  • drop.invalid.message: Whether to drop a Kafka message when it cannot be converted to an output message. Defaults to false if not used.

  • batch.size: The number of records to process as a batch when writing to Elasticsearch. This value defaults to 2000 if not used.

  • linger.ms: Linger time in milliseconds for batching. Records that arrive in between request transmissions are batched into a single bulk indexing request, based on the batch.size configuration. Normally this only occurs under load, when records arrive faster than they can be sent out. However, you may want to reduce the number of requests under light load, to get the benefits from bulk indexing. In other words, when a pending batch is not full, rather than immediately sending it out the task waits up to the given delay. This allows other records to be added so that they can be batched into a single request. This value defaults to 1000 ms (1 second) if not used.

  • flush.timeout.ms The timeout in milliseconds to use for periodic flushing and waiting for buffer space to be made available by completed requests, as records are added. If this timeout is exceeded the task fails. This value defaults to 10000 ms.

  • connection.compression: Whether to use Gzip compression on the HTTP connection to ElasticSearch. To make this setting work the http.compression setting must be set to true on the Elasticsearch nodes. For more information about the Elasticsearch HTTP properties, see Elasticsearch HTTP Settings. Defaults to false if not used.

Single Message Transforms: See the Single Message Transforms (SMT) documentation for details about adding SMTs using the CLI. See Unsupported transformations for a list of SMTs that are not supported with this connector.

See Configuration Properties for all property values and definitions.

Step 4: Load the configuration file and create the connector

Enter the following command to load the configuration and start the connector:

confluent connect cluster create --config-file <file-name>.json

For example:

confluent connect cluster create --config-file elasticsearch-sink-config.json

Example output:

Created connector elasticsearch-connector lcc-ix4dl

Step 5: Check the connector status

Enter the following command to check the connector status:

confluent connect cluster list

Example output:

ID          |       Name                 | Status  | Type
+-----------+----------------------------+---------+------+
lcc-ix4dl   | elasticsearch-connector    | RUNNING | sink

Step 6: Check the results in Elasticsearch.

Verify that new records are being added to the Elasticsearch deployment.

For more information and examples to use with the Confluent Cloud API for Connect, see the Confluent Cloud API for Connect Usage Examples section.

Tip

When you launch a connector, a Dead Letter Queue topic is automatically created. See View Connector Dead Letter Queue Errors in Confluent Cloud for details.

Understanding external.resource.usage configuration

The external.resource.usage property dictates how the Elasticsearch connector interacts with Elasticsearch resources (indices, data streams, or aliases). Its behavior changes based on its value and the presence of other data stream-related configurations. Consider the following scenarios:

  • When external.resource.usage = DISABLED (default) and data stream configurations not set

    The connector writes to a regular Elasticsearch index, which it automatically creates using the Kafka topic name. This is the default behavior when external.resource.usage is disabled and no data stream-specific configurations are provided.

  • When external.resource.usage = DISABLED and data stream configurations provided

    If external.resource.usage is DISABLED but data stream configurations are provided, the connector automatically creates a data stream named as {type}-{dataset}-{namespace} and writes to it. This occurs when:

    • data.stream.type is not set to none.

    • data.stream.dataset is not set to none.

    • data.stream.namespace (optional) defaults to ${topic} name if not explicitly set.

    • data.stream.timestamp.field (optional) defaults to the Kafka record timestamp if not set.

    The timestamp.field is used as the @timestamp for indexing; if not set, the Kafka record timestamp is used.

  • When external.resource.usage = INDEX or ALIAS_INDEX

    Users must pre-create the target Elasticsearch index or alias-to-index. A one-to-one mapping between Kafka topics and these pre-existing resources must be provided via the topic.to.external.resource.mapping configuration (for example, payments:index-payments, logs:alias-logs). Records from each topic are then written directly to its specified index or index alias.

  • When external.resource.usage = DATASTREAM or ALIAS_DATASTREAM

    Users must pre-create the target Elasticsearch data stream or alias-to-data stream. A one-to-one topic-to-resource mapping must be defined via topic.to.external.resource.mapping (for example, metrics:metrics-ds, orders:alias-orders-ds). A common timestamp field must be configured using data.stream.timestamp.field (or the Kafka timestamp will be used by default), as all data streams require an @timestamp field.

Configuration Properties

Use the following configuration properties with the fully-managed connector. For self-managed connector property definitions and other details, see the connector docs in Self-managed connectors for Confluent Platform.

Which topics do you want to get data from?

topics.regex

A regular expression that matches the names of the topics to consume from. This is useful when you want to consume from multiple topics that match a certain pattern without having to list them all individually.

  • Type: string

  • Importance: low

topics

Identifies the topic name or a comma-separated list of topic names.

  • Type: list

  • Importance: high

errors.deadletterqueue.topic.name

The name of the topic to be used as the dead letter queue (DLQ) for messages that result in an error when processed by this sink connector, or its transformations or converters. Defaults to ‘dlq-${connector}’ if not set. The DLQ topic will be created automatically if it does not exist. You can provide ${connector} in the value to use it as a placeholder for the logical cluster ID.

  • Type: string

  • Default: dlq-${connector}

  • Importance: low

Schema Config

schema.context.name

Add a schema context name. A schema context represents an independent scope in Schema Registry. It is a separate sub-schema tied to topics in different Kafka clusters that share the same Schema Registry instance. If not used, the connector uses the default schema configured for Schema Registry in your Confluent Cloud environment.

  • Type: string

  • Default: default

  • Importance: medium

Input messages

input.data.format

Sets the input Kafka record value format. Valid entries are AVRO, JSON_SR, PROTOBUF, or JSON. Note that you need to have Confluent Cloud Schema Registry configured if using a schema-based message format like AVRO, JSON_SR, and PROTOBUF.

  • Type: string

  • Default: JSON

  • Importance: high

How should we connect to your data?

name

Sets a name for your connector.

  • Type: string

  • Valid Values: A string at most 64 characters long

  • Importance: high

Kafka Cluster credentials

kafka.auth.mode

Kafka Authentication mode. It can be one of KAFKA_API_KEY or SERVICE_ACCOUNT. It defaults to KAFKA_API_KEY mode.

  • Type: string

  • Default: KAFKA_API_KEY

  • Valid Values: KAFKA_API_KEY, SERVICE_ACCOUNT

  • Importance: high

kafka.api.key

Kafka API Key. Required when kafka.auth.mode==KAFKA_API_KEY.

  • Type: password

  • Importance: high

kafka.service.account.id

The Service Account that will be used to generate the API keys to communicate with Kafka Cluster.

  • Type: string

  • Importance: high

kafka.api.secret

Secret associated with Kafka API key. Required when kafka.auth.mode==KAFKA_API_KEY.

  • Type: password

  • Importance: high

How should we connect to your Elasticsearch Service?

connection.url

Elasticsearch Service connection URI (e.g. https://123123.us-east-1.aws.found.io:9243).

  • Type: list

  • Importance: high

connection.username

The username used to authenticate with Elasticsearch Service.

  • Type: string

  • Importance: high

connection.password

The password used to authenticate with Elasticsearch Service.

  • Type: password

  • Importance: high

Security

elastic.security.protocol

This should be set to SSL if you want to enable PKI auth with SSL support. Otherwise all ssl configs are ignored. Note that the connector will still use SSL if https is used.

  • Type: string

  • Default: PLAINTEXT

  • Importance: medium

elastic.https.ssl.keystore.file

The key store file. This is optional for client and can be used for two-way authentication for client.

  • Type: password

  • Importance: medium

elastic.https.ssl.key.password

The password of the private key in the key store file. This is required for clients only if two-way authentication is configured.

  • Type: password

  • Importance: medium

elastic.https.ssl.keystore.password

The store password for the key store file. This is optional for client and only needed if ‘ssl.keystore.location’ is configured. Key store password is not supported for PEM format.

  • Type: password

  • Importance: medium

elastic.https.ssl.keystore.type

The file format of the key store file. This is optional for client.

  • Type: string

  • Default: JKS

  • Importance: medium

elastic.https.ssl.truststore.file

The Truststore file with the certificates of the trusted CAs.

  • Type: password

  • Importance: medium

elastic.https.ssl.truststore.password

The password for the trust store file. If a password is not set, trust store file configured will still be used, but integrity checking is disabled. Trust store password is not supported for PEM format.

  • Type: password

  • Importance: medium

elastic.https.ssl.truststore.type

The file format of the trust store file.

  • Type: string

  • Default: JKS

  • Importance: medium

elastic.https.ssl.keymanager.algorithm

The algorithm used by key manager factory for SSL connections.

  • Type: string

  • Default: SunX509

  • Importance: low

elastic.https.ssl.trustmanager.algorithm

The algorithm used by trust manager factory for SSL connections.

  • Type: string

  • Default: PKIX

  • Importance: low

elastic.https.ssl.endpoint.identification.algorithm

The endpoint identification algorithm to validate server hostname using server certificate.

  • Type: string

  • Default: https

  • Importance: low

Data Conversion

key.ignore

Whether to ignore the record key for the purpose of forming the Elasticsearch document ID. When this is set to true, document IDs will be generated as topic+partition+offset taken from the record. When this is set to false, the record key will be used as the Elasticsearch document ID.

  • Type: boolean

  • Default: false

  • Importance: low

topic.key.ignore

List of topics for which key.ignore should be true.

  • Type: list

  • Importance: low

schema.ignore

Whether to ignore schemas during indexing. When this is set to true, the record schema will be ignored for the purpose of registering an Elasticsearch mapping. Elasticsearch will infer the mapping from the data (dynamic mapping needs to be enabled by the user).

  • Type: boolean

  • Default: false

  • Importance: low

topic.schema.ignore

List of topics for which schema.ignore should be true.

  • Type: list

  • Importance: low

compact.map.entries

Defines how map entries with string keys within record values should be written to JSON. When this is set to true, these entries are written compactly as “entryKey”: “entryValue”. Otherwise, map entries with string keys are written as a nested document {“key”: “entryKey”, “value”: “entryValue”}.

  • Type: boolean

  • Default: true

  • Importance: low

write.method

Method used for writing data to Elasticsearch, and one of INSERT or UPSERT. The default method is INSERT, in which the connector constructs a document from the record value and inserts that document into Elasticsearch, completely replacing any existing document with the same ID; this matches previous behavior. The UPSERT method will create a new document if one with the specified ID does not yet exist, or will update an existing document with the same ID by adding/replacing only those fields present in the record value. The UPSERT method may require additional time and resources of Elasticsearch, so consider increasing the read.timeout.ms and decreasing the batch.size configuration properties.

  • Type: string

  • Default: INSERT

  • Importance: low

external.version.header

Header name to pull value for external versioning, defaults to using the kafka record offset. Must have a numeric value.

  • Type: string

  • Default: “”

  • Importance: low

use.autogenerated.ids

Specifies whether to use auto-generated Elasticsearch document IDs for insertion requests. Note that this setting removes exactly once guarantees, and message delivery will be at least once. This only applies if the write method is set to INSERT. When set to true, the Ignore Key mode option will also be ignored when sending data to Elasticsearch.

  • Type: boolean

  • Default: false

  • Importance: low

Error Handling

behavior.on.null.values

How to handle records with a non-null key and a null value (i.e. Kafka tombstone records). Valid options are ignore, delete, and fail. Ignore will skip the record. Delete will delete the record. Fail will fail the connector.

  • Type: string

  • Default: ignore

  • Importance: low

behavior.on.malformed.documents

How to handle records that Elasticsearch rejects due to some malformation of the document itself, such as an index mapping conflict, a field name containing illegal characters, or a record with a missing id. ‘ignore’ will skip the bad records and ‘fail’ will fail the connector.

  • Type: string

  • Default: fail

  • Importance: low

drop.invalid.message

Whether to drop a record if it cannot be converted to an Elasticsearch document.

  • Type: boolean

  • Default: false

  • Importance: low

Connection Details

batch.size

The number of records to process as a batch when writing to Elasticsearch.

  • Type: int

  • Default: 2000

  • Valid Values: [1,…]

  • Importance: medium

linger.ms

Linger time in milliseconds for batching. Records that arrive in between request transmissions are batched into a single bulk indexing request, based on the batch.size configuration. Normally this only occurs under load when records arrive faster than they can be sent out. However, it may be desirable to reduce the number of requests even under light load and benefit from bulk indexing. This setting helps accomplish that - when a pending batch is not full, rather than immediately sending it out the task will wait up to the given delay to allow other records to be added so that they can be batched into a single request.

  • Type: int

  • Default: 1000 (1 second)

  • Valid Values: [1000,…]

  • Importance: low

flush.timeout.ms

The timeout in milliseconds to use for periodic flushing, and when waiting for buffer space to be made available by completed requests as records are added. If this timeout is exceeded the task will fail.

  • Type: int

  • Default: 10000 (10 seconds)

  • Valid Values: [1000,…]

  • Importance: low

connection.compression

Whether to use GZip compression on HTTP connection to ElasticSearch. To make this setting to work the http.compression setting also needs to be enabled at the Elasticsearch nodes before using it.

  • Type: boolean

  • Default: false

  • Importance: low

read.timeout.ms

How long to wait in milliseconds for the Elasticsearch server to send a response. The task fails if any read operation times out.

  • Type: int

  • Default: 15000 (15 seconds)

  • Valid Values: [1000,…,60000]

  • Importance: low

Consumer configuration

max.poll.interval.ms

The maximum delay between subsequent consume requests to Kafka. This configuration property may be used to improve the performance of the connector, if the connector cannot send records to the sink system. Defaults to 300000 milliseconds (5 minutes).

  • Type: long

  • Default: 300000 (5 minutes)

  • Valid Values: [60000,…,1800000] for non-dedicated clusters and [60000,…] for dedicated clusters

  • Importance: low

max.poll.records

The maximum number of records to consume from Kafka in a single request. This configuration property may be used to improve the performance of the connector, if the connector cannot send records to the sink system. Defaults to 500 records.

  • Type: long

  • Default: 500

  • Valid Values: [1,…,500] for non-dedicated clusters and [1,…] for dedicated clusters

  • Importance: low

Number of tasks for this connector

tasks.max

Maximum number of tasks for the connector.

  • Type: int

  • Valid Values: [1,…]

  • Importance: high

External Resource Mapping

external.resource.usage

The type of external resource the connector writes to, such as indices, datastreams or aliases. Valid options are INDEX, DATASTREAM, ALIAS_INDEX, ALIAS_DATASTREAM, and DISABLED. When set to DISABLED, the connector will auto-create indices or datastreams based on the topic name and datastream configurations.

  • Type: string

  • Default: DISABLED

  • Importance: high

topic.to.external.resource.mapping

A list of topic-to-resource mappings in the format ‘topic:resource’. If specified, the connector will use the provided resource name (index, data stream, or alias) instead of the topic name for writing to Elasticsearch. The resource must exist in Elasticsearch before configuring the connector. The type of resource (index, data stream, or alias) is determined by the ‘external.resource.usage’ configuration.

  • Type: list

  • Default: “”

  • Importance: high

Data Streams

data.stream.type

Describes the generic type of data to be written to a data stream. The default value is none, indicating that the connector will write to regular indices. If set, this configuration will be used alongside data.stream.dataset to construct the data stream name in the form of {data.stream.type}-{data.stream.dataset}-{data.stream.namespace}. Possible values are logs, metrics, none, and custom index templates defined in the destination cluster are also supported.

  • Type: string

  • Default: none

  • Importance: low

data.stream.dataset

Describes the data ingested and its structure to be written to a data stream. This can be any arbitrary string, provided it is no longer than 100 characters, in all lowercase, and does not contain spaces or any special characters /\*"<>|,#:-. If no value is set, the connector writes to regular indices. If set, this configuration will be used alongside data.stream.type to construct the data stream name in the form of {data.stream.type}-{data.stream.dataset}-{data.stream.namespace}.

  • Type: string

  • Default: “”

  • Importance: low

data.stream.namespace

Generic name describing a user-configurable arbitrary grouping for writing to a data stream. It can be any string up to 100 characters, in lowercase, without spaces or special characters (/*”<>|,#:-). If unset, the connector writes to regular indices. When set, it is used with data.stream.type and data.stream.dataset to form the data stream name in the format {data.stream.type}-{data.stream.dataset}-{data.stream.namespace}. Default is ${topic}, which means the topic name.

  • Type: string

  • Default: ${topic}

  • Importance: low

data.stream.timestamp.field

All documents sent to a data stream need an @timestamp field with values of type date or date_nanos. Otherwise, the document will not be sent. If multiple fields are provided, the first field listed that also appears in the record will be used. If this configuration is left empty, all of the documents will use the Kafka record timestamp as the @timestamp field value. Note that @timestamp still needs to be explicitly listed if records already contain this field.

  • Type: list

  • Default: “”

  • Importance: low

Additional Configs

consumer.override.auto.offset.reset

Defines the behavior of the consumer when there is no committed position (which occurs when the group is first initialized) or when an offset is out of range. You can choose either to reset the position to the “earliest” offset (the default) or the “latest” offset. You can also select “none” if you would rather set the initial offset yourself and you are willing to handle out of range errors manually. More details: https://docs.confluent.io/platform/current/installation/configuration/consumer-configs.html#auto-offset-reset

  • Type: string

  • Importance: low

consumer.override.isolation.level

Controls how to read messages written transactionally. If set to read_committed, consumer.poll() will only return transactional messages which have been committed. If set to read_uncommitted (the default), consumer.poll() will return all messages, even transactional messages which have been aborted. Non-transactional messages will be returned unconditionally in either mode. More details: https://docs.confluent.io/platform/current/installation/configuration/consumer-configs.html#isolation-level

  • Type: string

  • Importance: low

header.converter

The converter class for the headers. This is used to serialize and deserialize the headers of the messages.

  • Type: string

  • Importance: low

value.converter.allow.optional.map.keys

Allow optional string map key when converting from Connect Schema to Avro Schema. Applicable for Avro Converters.

  • Type: boolean

  • Importance: low

value.converter.auto.register.schemas

Specify if the Serializer should attempt to register the Schema.

  • Type: boolean

  • Importance: low

value.converter.connect.meta.data

Allow the Connect converter to add its metadata to the output schema. Applicable for Avro Converters.

  • Type: boolean

  • Importance: low

value.converter.enhanced.avro.schema.support

Enable enhanced schema support to preserve package information and Enums. Applicable for Avro Converters.

  • Type: boolean

  • Importance: low

value.converter.enhanced.protobuf.schema.support

Enable enhanced schema support to preserve package information. Applicable for Protobuf Converters.

  • Type: boolean

  • Importance: low

value.converter.flatten.unions

Whether to flatten unions (oneofs). Applicable for Protobuf Converters.

  • Type: boolean

  • Importance: low

value.converter.generate.index.for.unions

Whether to generate an index suffix for unions. Applicable for Protobuf Converters.

  • Type: boolean

  • Importance: low

value.converter.generate.struct.for.nulls

Whether to generate a struct variable for null values. Applicable for Protobuf Converters.

  • Type: boolean

  • Importance: low

value.converter.int.for.enums

Whether to represent enums as integers. Applicable for Protobuf Converters.

  • Type: boolean

  • Importance: low

value.converter.latest.compatibility.strict

Verify latest subject version is backward compatible when use.latest.version is true.

  • Type: boolean

  • Importance: low

value.converter.object.additional.properties

Whether to allow additional properties for object schemas. Applicable for JSON_SR Converters.

  • Type: boolean

  • Importance: low

value.converter.optional.for.nullables

Whether nullable fields should be specified with an optional label. Applicable for Protobuf Converters.

  • Type: boolean

  • Importance: low

value.converter.optional.for.proto2

Whether proto2 optionals are supported. Applicable for Protobuf Converters.

  • Type: boolean

  • Importance: low

value.converter.scrub.invalid.names

Whether to scrub invalid names by replacing invalid characters with valid characters. Applicable for Avro and Protobuf Converters.

  • Type: boolean

  • Importance: low

value.converter.use.latest.version

Use latest version of schema in subject for serialization when auto.register.schemas is false.

  • Type: boolean

  • Importance: low

value.converter.use.optional.for.nonrequired

Whether to set non-required properties to be optional. Applicable for JSON_SR Converters.

  • Type: boolean

  • Importance: low

value.converter.wrapper.for.nullables

Whether nullable fields should use primitive wrapper messages. Applicable for Protobuf Converters.

  • Type: boolean

  • Importance: low

value.converter.wrapper.for.raw.primitives

Whether a wrapper message should be interpreted as a raw primitive at root level. Applicable for Protobuf Converters.

  • Type: boolean

  • Importance: low

errors.tolerance

Use this property if you would like to configure the connector’s error handling behavior. WARNING: This property should be used with CAUTION for SOURCE CONNECTORS as it may lead to dataloss. If you set this property to ‘all’, the connector will not fail on errant records, but will instead log them (and send to DLQ for Sink Connectors) and continue processing. If you set this property to ‘none’, the connector task will fail on errant records.

  • Type: string

  • Default: all

  • Importance: low

key.converter.key.subject.name.strategy

How to construct the subject name for key schema registration.

  • Type: string

  • Default: TopicNameStrategy

  • Importance: low

value.converter.decimal.format

Specify the JSON/JSON_SR serialization format for Connect DECIMAL logical type values with two allowed literals:

BASE64 to serialize DECIMAL logical types as base64 encoded binary data and

NUMERIC to serialize Connect DECIMAL logical type values in JSON/JSON_SR as a number representing the decimal value.

  • Type: string

  • Default: BASE64

  • Importance: low

value.converter.flatten.singleton.unions

Whether to flatten singleton unions. Applicable for Avro and JSON_SR Converters.

  • Type: boolean

  • Default: false

  • Importance: low

value.converter.ignore.default.for.nullables

When set to true, this property ensures that the corresponding record in Kafka is NULL, instead of showing the default column value. Applicable for AVRO,PROTOBUF and JSON_SR Converters.

  • Type: boolean

  • Default: false

  • Importance: low

value.converter.reference.subject.name.strategy

Set the subject reference name strategy for value. Valid entries are DefaultReferenceSubjectNameStrategy or QualifiedReferenceSubjectNameStrategy. Note that the subject reference name strategy can be selected only for PROTOBUF format with the default strategy being DefaultReferenceSubjectNameStrategy.

  • Type: string

  • Default: DefaultReferenceSubjectNameStrategy

  • Importance: low

value.converter.replace.null.with.default

Whether to replace fields that have a default value and that are null to the default value. When set to true, the default value is used, otherwise null is used. Applicable for JSON Converter.

  • Type: boolean

  • Default: true

  • Importance: low

value.converter.schemas.enable

Include schemas within each of the serialized values. Input messages must contain schema and payload fields and may not contain additional fields. For plain JSON data, set this to false. Applicable for JSON Converter.

  • Type: boolean

  • Default: false

  • Importance: low

value.converter.value.subject.name.strategy

Determines how to construct the subject name under which the value schema is registered with Schema Registry.

  • Type: string

  • Default: TopicNameStrategy

  • Importance: low

Auto-restart policy

auto.restart.on.user.error

Enable connector to automatically restart on user-actionable errors.

  • Type: boolean

  • Default: true

  • Importance: medium

Suggested Reading

The following blog posts provide data pipeline examples using the Confluent Cloud Elasticsearch Service Sink connector.

Next Steps

For an example that shows fully-managed Confluent Cloud connectors in action with Confluent Cloud for Apache Flink, see the Cloud ETL Demo. This example also shows how to use Confluent CLI to manage your resources in Confluent Cloud.

../_images/topology.png