Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to disable schema Avro? #82

Open
SarindraTherese opened this issue Oct 11, 2022 · 1 comment
Open

How to disable schema Avro? #82

SarindraTherese opened this issue Oct 11, 2022 · 1 comment

Comments

@SarindraTherese
Copy link

SarindraTherese commented Oct 11, 2022

When I read topic after use your elasticsearch source connector, I have value like this:

{"schema":
    {"type":"struct",
    "fields":[
        {"type":"string","optional":true,"field":"nature"},
        {"type":"string","optional":true,"field":"description"},
        {"type":"string","optional":true,"field":"threshold"},
        {"type":"string","optional":true,"field":"quality"},
        {"type":"string","optional":true,"field":"rowid"},
        {"type":"string","optional":true,"field":"avrotimestamp"},
        {"type":"array","items":{"type":"string","optional":true},"optional":true,"field":"null"},
        {"type":"string","optional":true,"field":"domain"},
        {"type":"string","optional":true,"field":"name"},
        {"type":"string","optional":true,"field":"avroversion"},
        {"type":"string","optional":true,"field":"esindex"},
        {"type":"string","optional":true,"field":"value"},
        {"type":"string","optional":true,"field":"chrono"},
        {"type":"string","optional":true,"field":"esid"},
        {"type":"string","optional":true,"field":"ts"}],"optional":false,"name":"demofilter"},
    "payload":
    {
        "nature":"R01",
        "description":"Energy",
        "threshold":"","quality":"192",
        "rowid":"34380941",
        "avrotimestamp":"2022-09-20T04:00:11.939Z",
        "null":["TGT BQ 1B"],
        "domain":"CFO",
        "name":"RDC.R01.RED.MES",
        "avroversion":"1",
        "esindex":"demo_filter",
        "value":"4468582",
        "chrono":"133081200000000000",
        "esid":"nuWIrYMBHyNMgyhJYscV",
        "ts":"2022-09-20T02:00:00.000Z"
    }
}

My question is can I configure the format to json in file json properties?
The only output i need is like this:

    {
        "nature":"R01",
        "description":"Energy",
        "threshold":"","quality":"192",
        "rowid":"34380941",
        "avrotimestamp":"2022-09-20T04:00:11.939Z",
        "null":["TGT BQ 1B"],
        "domain":"CFO",
        "name":"RDC.R01.RED.MES",
        "avroversion":"1",
        "esindex":"demo_filter",
        "value":"4468582",
        "chrono":"133081200000000000",
        "esid":"nuWIrYMBHyNMgyhJYscV",
        "ts":"2022-09-20T02:00:00.000Z"
    }

thanks

@DarioBalinzo
Copy link
Owner

Hi,
you can use this settings that works on all connectors (not just this one):

In particular you can set
key.converter to org.apache.kafka.connect.json.JsonConverter as explained here: https://www.confluent.io/blog/kafka-connect-deep-dive-converters-serialization-explained/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants