简体   繁体   English

Kafka Connect Elasticsearch 带有自定义路由的接收器连接器

[英]Kafka Connect Elasticsearch Sink Connector with custom _routing

I am trying to workout a Kafka Connect Sink connector for Elasticsearch 6.x我正在尝试为 Elasticsearch 6.x 锻炼 Kafka Connect Sink 连接器

From an informative blog I can see that it is possible to route document to different Elasticsearch indices.从内容丰富的博客中,我可以看到可以将文档路由到不同的 Elasticsearch 索引。

Question问题

How can I provide custom _routing value while using ES sink connector.如何在使用 ES sink 连接器时提供自定义 _routing 值。 For example, if my document has field 'customerId' which is present in Kafka message's value, how can i choose its value as the _routing so that the document lands in correct shard of the indice.例如,如果我的文档具有 Kafka 消息值中存在的字段“customerId”,我如何选择它的值作为_routing以便文档落在索引的正确分片中。

Kafka connect connector provided by confluent till the version 11.0.0, doesn't have a document routing option in it. confluent提供的 Kafka 连接连接器直到版本 11.0.0,其中没有文档路由选项。 Hence it is impossible to set the document routing for the ES index on the connector itself with any SMT.因此,不可能使用任何 SMT 在连接器本身上设置 ES 索引的文档路由。 But custom routing can be setup on the ES index by using a pipeline.但是可以使用管道在 ES 索引上设置自定义路由。

Check the related answer here .此处查看相关答案。 It shows how to setup pipeline and use it on elasticsearch.它展示了如何设置管道并在 elasticsearch 上使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM