# Setting document type with dynamic mapping to 'strict'

**URL:** <https://discuss.elastic.co/t/setting-document-type-with-dynamic-mapping-to-strict/107959>\
**Category:** Logstash\
**Created:** [November 16, 2017, 2:43pm UTC](https://discuss.elastic.co/t/setting-document-type-with-dynamic-mapping-to-strict/107959 "2017-11-16T14:43:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![makibroshett](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/makibroshett/32/106322_2.png) [@makibroshett](https://discuss.elastic.co/u/makibroshett)\
**Post date:** [November 16, 2017, 2:43pm UTC](https://discuss.elastic.co/t/setting-document-type-with-dynamic-mapping-to-strict/107959/1 "2017-11-16T14:43:32Z")

</div>

Hi,

I'm using a template with strict dynamic mapping turned on (i.e. ES output plugin will reject documents that don't have a defined mapping, or if the fields do not correspond to the mapping definition). I use this in order to validate the documents.

When I use that in logstash, the event "type" field set by the input plugin gets in the way: the final document has both "type" and a "\_type" fields with the same value. As a result the document is not indexed because the "type" field is not defined in my mapping.

How can I have the elastic output filter properly define the document type with additionally having this "type" field in the source ?

Thanks for your help

Olivier

---

<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:** [December 14, 2017, 2:43pm UTC](https://discuss.elastic.co/t/setting-document-type-with-dynamic-mapping-to-strict/107959/2 "2017-12-14T14:43:52Z")

</div>

Closed on December 14, 2017, 2:43pm UTC

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