I' getting following error:
status=>400,
: action=>[
"index",
{
: _id=>nil,
: _index=>"mongodata",
: _type=>"mytype1",
: _routing=>nil
},
#
],
: response=>{
"index"=>{
"_index"=>"mongodata",
"_type"=>"mytype1",
"_id"=>"odSwBGEBmyc6bJc236_X",
"status"=>400,
"error"=>{
"type"=>"mapper_parsing_exception",
"reason"=>"Field [_id] is a metadata field and cannot be added inside a document. Use the index API request parameters."
}
}
}
}
_id field is belong to database.
Please suggest.
It looks like the document you're trying to send to ES has a _id field which isn't allowed. This is probably caused by a mistake in your configuration.
I'm using DBSCHEMA Jdbc. i'm using following config file. My database has _id Column. So i used renamed this column in filter script.
My config file is following:
input{
jdbc{
jdbc_driver_library => "/app/elastic/logstash-6.1.0/lib/dbschema/mongojdbc1.2.jar"
jdbc_driver_class => "Java::com.dbschema.MongoJdbcDriver"
jdbc_connection_string => "jdbc:mongodb://houbiap5.**********:27017/test"
jdbc_user => ""
statement => "db.getCollection('EmployeeLoad').find({})"
}
}
filter {
mutate {
rename => { "[_id]" => "documentId" }
}
}
output {
stdout { codec => rubydebug }
elasticsearch {
hosts => ["*************"]
index => 'mongodbschema'
document_type => "mytype1"
}
}
This is giving Following error.
Exception when executing JDBC query {:exception=>#<Sequel::DatabaseError: Java::OrgLogstash::MissingConverterException: Missing Converter handling for full class name=org.bson.types.ObjectId, simple name=ObjectId>}
Please suggest.
It looks like there's a column in the result set of the type ObjectId that you need to type cast to e.g. a string.
Could you please elaboration this? How can do this.
Change your SQL query to convert the data type of the ObjectId column(s) to varchar or whatever.