mapper_parsing_exception while trying to index a Avro document with double field

Viewed 20

I'm using Kafka Connect Elasticsearch to index data from a Kafka topic to elasticsearch. And I'm getting

{
"type":"mapper_parsing_exception",
"reason":"failed to parse field [price] of type [double] in document with id 'my-topic+1+1'. Preview of field's value:'AW/G5DsmAAA='",
"caused_by":{
    "type":"number_format_exception",
    "reason":"For input string: \"AW/G5DsmAAA=\""
}

}

The topic carries Avro format messages, and the data type of this 'price' field is defined as bytes, with decimal as the logical type.

{
    "name" : "price",
    "type": [
        "null", {
            "type": "bytes",
            "logicalType": "decimal",
            "precision": 45,
            "scale": 15
        }
    ],
    "default" : null
}

I can understand that the floating point number is encoded as a base64 string and the Kafka connecter is reading the encoded value as it is and hence the error. But I'm not sure how do I tell the connector to decode it and read it as a floating point number instead? Or it is something I should configure at the Kafka message producer side (I use Spring kafka streams + Avro Serde to write the message). My type for this 'price' field in elasticsearch mapping is double.

0 Answers
Related