How to deserialize Avro schema and then abandon schema before write to ES Sink Connector using SMT

Viewed 86

Use Case and Description

My use case is described more here, but the gist of the issue is:

I am making a custom SMT and want to make sure the Elasticsearch sink connector deserializes incoming records properly, but then after that I don't need any sort of schema at all. Each record has a dynamic amount of fields set, so I don't want to have any makeUpdatedSchema step (e.g., this code) at all. This both keeps code more simple and I would assume improves performance since I don't have to recreate schemas for each record.

What I tried

I tried doing something like the applySchemaless code as shown here even when the record has a schema by returning something like this, with null for schema:

return newRecord(record, null, updatedValue);

However, in runtime it errors out, saying I have an incompatible schema.

Key Question

I might be misunderstanding the role of the schema at this point in the process (is it needed at all once we're in the Elasticsearch sink connector?) or how it works, and if so that would be helpful to know as well. But is there some way to write a custom SMT like this?

0 Answers
Related