# Inputting Mongodb events in Elasticsearch \_id is a metadatafield and cannot be added

**URL:** <https://discuss.elastic.co/t/inputting-mongodb-events-in-elasticsearch--id-is-a-metadatafield-and-cannot-be-added/85356>\
**Category:** Logstash\
**Created:** [May 11, 2017, 9:21am UTC](https://discuss.elastic.co/t/inputting-mongodb-events-in-elasticsearch--id-is-a-metadatafield-and-cannot-be-added/85356 "2017-05-11T09:21:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lisadeng](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lisadeng/32/15458_2.png) [@lisadeng](https://discuss.elastic.co/u/lisadeng)\
**Post date:** [May 11, 2017, 9:21am UTC](https://discuss.elastic.co/t/inputting-mongodb-events-in-elasticsearch--id-is-a-metadatafield-and-cannot-be-added/85356/1 "2017-05-11T09:21:01Z")

</div>

We're outputting mongodb records into filebeat, and then sending those filebeat logs to Elasticsearch, where it will be converted to Json.

However, Mongo has an \_id field already, so we get a failed action error from Logstash.  
I'm trying to delete the \_id field from Mongo.  
I thought that I could try to remove the \_id field in the filter plugin before it got to output, but I still get the failed action error.

Any tips on how to mitigate this problem?

---

<div class="post-metadata">

**Author:** ![lisadeng](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lisadeng/32/15458_2.png) [@lisadeng](https://discuss.elastic.co/u/lisadeng)\
**Post date:** [May 11, 2017, 9:42am UTC](https://discuss.elastic.co/t/inputting-mongodb-events-in-elasticsearch--id-is-a-metadatafield-and-cannot-be-added/85356/2 "2017-05-11T09:42:52Z")

</div>

I figured that one workaround  
would be that instead of specifying the codec =\> json on the input plugin,  
that I instead use the json filter, and do target =\> doc, which nests the fields.  
I would've preferred them on the top level, but this works fine as well.

---

<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:** [June 8, 2017, 9:52am UTC](https://discuss.elastic.co/t/inputting-mongodb-events-in-elasticsearch--id-is-a-metadatafield-and-cannot-be-added/85356/3 "2017-06-08T09:52:33Z")

</div>

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