# Inserting mongodb collection in to elasticsearch give me error

**URL:** <https://discuss.elastic.co/t/inserting-mongodb-collection-in-to-elasticsearch-give-me-error/77001>\
**Category:** Logstash\
**Created:** [March 1, 2017, 2:45pm UTC](https://discuss.elastic.co/t/inserting-mongodb-collection-in-to-elasticsearch-give-me-error/77001 "2017-03-01T14:45:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![111159](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/111159/32/15976_2.png) [@111159](https://discuss.elastic.co/u/111159)\
**Post date:** [March 1, 2017, 2:45pm UTC](https://discuss.elastic.co/t/inserting-mongodb-collection-in-to-elasticsearch-give-me-error/77001/1 "2017-03-01T14:45:38Z")

</div>

Hello I'm trying to insert mongodb collection to elasticsearch with this conf file but it give me following error.  
"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."}}}}  
I think generateId =\> false configuration will solve this problem but it still give me the same error  
How can i solve this problem?  
My code:  
input {  
mongodb {  
uri =\> 'mongodb://mongodbid:mongodbpassword@iplocationofmongodb/dbname'  
placeholder\_db\_dir =\> "/opt/logstash-mongodb/"  
placeholder\_db\_name =\> "/logstash\_sqlite.db"  
collection =\> "logs"  
generateId =\> false  
batch\_size =\> 5000  
}  
}  
filter {  
}  
output {  
stdout {codec =\> rubydebug}  
elasticsearch {  
user =\> "elastic"  
password =\> "homemaster1!"  
hosts =\>"localhost"  
index =\> "mongodb\_log"  
}  
}

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 29, 2017, 2:46pm UTC](https://discuss.elastic.co/t/inserting-mongodb-collection-in-to-elasticsearch-give-me-error/77001/2 "2017-03-29T14:46:01Z")

</div>

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