Home > Blockchain >  logstash input jdbc take mysql tinyint 0/1 as boolean true/false
logstash input jdbc take mysql tinyint 0/1 as boolean true/false

Time:11-22

In mysql table, has a tinyint type like this, which just store 0 or 1 value like is_mel:1.

is_mel | tinyint(1)

In Elasticsearch index mapping config is_mel as integer.

But from the logstash log, it show it parse the is_mel as boolean value true or false like "is_mel":true, which will lead to below error,

"type"=>"mapper_parsing_exception",
"reason"=>"failed to parse field [is_mel] of type [integer] in document with id '392289'. Preview of field's value: 'true'"

CodePudding user response:

It's actually a feature, not a bug :-)

You can append tinyInt1isBit=false to your JDBC URL to disable that behavior

jdbc.url=jdbc:mysql://127.0.0.1:3306/testdb?tinyInt1isBit=false
                                                    ^
                                                    |
                                                 add this

Link to the related MySQL doc

  • Related