# How to conditionally set the type?

**URL:** <https://discuss.elastic.co/t/how-to-conditionally-set-the-type/32862>\
**Category:** Logstash\
**Created:** [October 23, 2015, 3:03pm UTC](https://discuss.elastic.co/t/how-to-conditionally-set-the-type/32862 "2015-10-23T15:03:25Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![WoJ](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/woj/32/4518_2.png) [@WoJ](https://discuss.elastic.co/u/WoJ)\
**Post date:** [October 23, 2015, 5:02pm UTC](https://discuss.elastic.co/t/how-to-conditionally-set-the-type/32862/5 "2015-10-23T17:02:34Z")

</div>

I understand thanks.

I set `type` following your example and I end up in `ES` with a field `type` (in `_source`) **and** a field `_type` in the meta data. They both have the same value, the one I used when setting `type`in `logstash`.

Should I deduce from this that the **field** called `type` in `logstash` is treated in a special way by the `elasticsearch` output plugin - by assuming that its value should also be used to populate `_type` before sending to `ES` ?

---

_[View the full topic](https://discuss.elastic.co/t/how-to-conditionally-set-the-type/32862)._
