kafka avro elasticsearch 消费者允许未知密钥
kafka avro elasticsearch consumer allow unknown keys
有没有办法让 Kafka-Avro 接受来自生产者的所有密钥,即使它们没有在生产者模式中定义?目前我是 运行 的制作人
./bin/kafka-avro-console-producer --broker-list localhost:9092 --topic elasticsearch-sink --property value.schema='{"type":"record","name":"myRecord", "fields":[{"name":"esKey", type":"string"}]}'
并传入
{"esKey":"keyExample", "undefinedKey": "empty"}
消费者只会显示
{"esKey":"keyExample"}
所以未定义的键也不会被发送到 ElasticSearch。
由于输入非常大且不可预测,我宁愿不定义架构。
编辑:使用 Confluent 4.1.1
您的架构不允许其他字段
"fields":[{"name":"esKey", type":"string"}]
您需要在其中添加 undefinedKey
才能显示该字段。基本上,Avro 解串器没有理由认为另一个字段应该存在。
I'd rather not define the schema due to the input being very large and not predictable.
不清楚这意味着什么,但如果您有不可预测的数据,那么也许 Avro 或任何严格定义的模式协议不是最佳选择?
有没有办法让 Kafka-Avro 接受来自生产者的所有密钥,即使它们没有在生产者模式中定义?目前我是 运行 的制作人
./bin/kafka-avro-console-producer --broker-list localhost:9092 --topic elasticsearch-sink --property value.schema='{"type":"record","name":"myRecord", "fields":[{"name":"esKey", type":"string"}]}'
并传入
{"esKey":"keyExample", "undefinedKey": "empty"}
消费者只会显示
{"esKey":"keyExample"}
所以未定义的键也不会被发送到 ElasticSearch。 由于输入非常大且不可预测,我宁愿不定义架构。
编辑:使用 Confluent 4.1.1
您的架构不允许其他字段
"fields":[{"name":"esKey", type":"string"}]
您需要在其中添加 undefinedKey
才能显示该字段。基本上,Avro 解串器没有理由认为另一个字段应该存在。
I'd rather not define the schema due to the input being very large and not predictable.
不清楚这意味着什么,但如果您有不可预测的数据,那么也许 Avro 或任何严格定义的模式协议不是最佳选择?