Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rmoff/d2b2e3ae4039707036420f4a54eb6618 to your computer and use it in GitHub Desktop.
Save rmoff/d2b2e3ae4039707036420f4a54eb6618 to your computer and use it in GitHub Desktop.
curl -i -X PUT -H "Content-Type:application/json" \
http://localhost:8083/connectors/sink-elastic-orders-00/config \
-d '{
"connector.class": "io.confluent.connect.elasticsearch.ElasticsearchSinkConnector",
"topics": "orders",
"connection.url": "http://elasticsearch:9200",
"type.name": "type.name=kafkaconnect",
"key.ignore": "true",
"schema.ignore": "false",
"errors.tolerance":"all",
"transforms": "addTS,InsertTopic,InsertOffset,InsertPartition",
"transforms.addTS.type": "org.apache.kafka.connect.transforms.InsertField$Value",
"transforms.addTS.timestamp.field": "op_ts",
"transforms.InsertTopic.type":"org.apache.kafka.connect.transforms.InsertField$Value",
"transforms.InsertTopic.topic.field":"source_topic",
"transforms.InsertOffset.type":"org.apache.kafka.connect.transforms.InsertField$Value",
"transforms.InsertOffset.offset.field":"source_offset",
"transforms.InsertPartition.type":"org.apache.kafka.connect.transforms.InsertField$Value",
"transforms.InsertPartition.partition.field":"source_partition"
}'
@manojkupadhyay
Copy link

manojkupadhyay commented Jun 28, 2020

Do we have a way to use message field value for ElasticSearch index? Means i push old historical data into Kafka then ElasticsearchSinkConnector should be able to push into right ES index "indexPrefix-{messageCreatedDate}". I am not that Timestamp transforms can be used in this case

@cyberjar09
Copy link

is there a way to add the kafka record key to the value before sending it to a sink? This is not specific to elasticsearch but any sink. I can't seem to find such a transform, and it seems to me like it should be a solved problem 🤔

@rmoff
Copy link
Author

rmoff commented Dec 6, 2022

@cyberjar09 I found https://github.com/jzaralim/KeyToValueTransform and also discussion here: https://www.mail-archive.com/users@kafka.apache.org/msg37254.html. You can also use Kafka Streams, ksqlDB, etc.

@cyberjar09
Copy link

hey thanks a lot for the guidance @rmoff 🎉
much appreciated! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment