[英]Route message to different ElasticSearchIndex using Kafka-Connect
我有一個 kafka 主題,正在向其發布多種類型的消息(都是 JSON),其標頭屬性為:- eventType = "abc" 或 eventType = "xyz" 或 eventType = "def" 等。
我的要求是根據 kafka 中發送的 eventType 標頭字段將這些消息從 Kafka 主題發送到不同的 elasticSearch 索引。 eg if eventType = "abc", push data to elasticsearch index = "abc123" if eventType = "xyz", push data to elasticsearch index = "xyz123"
我計划使用 kafka connect 進行此操作。 我需要幫助如何使用 kafka-connect 實現這一目標?
我正在使用 kafka 1.1.0 並計划使用 confluentinc-kafka-connect-elasticsearch--plugin。
這是我的彈性搜索接收器連接配置文件:-
name=elasticsearch-sink
connector.class=io.confluent.connect.elasticsearch.ElasticsearchSinkConnector
tasks.max=1
topics=test-elasticsearch-sink
topic.index.map=test-1:elastic_purchase_index1
key.ignore=true
connection.url=<url>
type.name=purchasev1
key.ignore=true
schema.ignore=true
基於 eventType 頭域
使用ExtractTopic$Value
+ RegexRouter
將消息路由到單個索引。
然后在 ElasticSearch 接收器中使用topics.regex
來定義要讀取的主題的模式
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.