Cast mongodb _id object to string


(Nikhil Mahajan) #1

Hi,
I am working on creating a pipeline to get data from MongoDB to ElasticSearch using Logstash.
I am using dbschema mongodb jdbc drivers. I am able to connect to database using driver but I am facing issue with _id . As in MongoDB its of type object So I am getting issue with converter. Here is error I am getting

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>}

My pipeline is as below :

input{
jdbc{
jdbc_driver_library => "C:/logstash-6.1.0/logstash-6.1.0/bin/driver/mongo/dbschema/mongojdbc1.2.jar"
jdbc_driver_class => "Java::com.dbschema.MongoJdbcDriver"
jdbc_connection_string => "jdbc:mongodb://abc.com:27017/test"
jdbc_user => ""
statement => "db.getCollection('Employee').find({})"
codec => json
}
}

output {
elasticsearch {
hosts => 'http://localhost:9200'
index => 'mongodbschema'
codec => json
}
stdout { codec => rubydebug }
}

Is there any way I can convert/cast or do something in filter to change datatype of _id from object to string


(Nikhil Mahajan) #2

no one faced this problem.. where they want to keep _id same in Elasticsearch ?


(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.