# Can check data type before output?

**URL:** <https://discuss.elastic.co/t/can-check-data-type-before-output/67452>\
**Category:** Logstash\
**Created:** [November 29, 2016, 8:46am UTC](https://discuss.elastic.co/t/can-check-data-type-before-output/67452 "2016-11-29T08:46:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tao\_hiko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tao_hiko/32/707_2.png) [@tao\_hiko](https://discuss.elastic.co/u/tao_hiko)\
**Post date:** [November 29, 2016, 8:46am UTC](https://discuss.elastic.co/t/can-check-data-type-before-output/67452/1 "2016-11-29T08:46:34Z")

</div>

I'm using Logstash 5.0 and migrate data from ES 1.7 to ES 5.0 but I have a problem about conflicted data type on the same filed name but different type.

How to check data type of each field?

Because I cannot change some format of fields (object and string that cannot use instead of each other) so I have to rename it by adding postfix or prefix in field name.

Thanks,  
Hiko

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [November 29, 2016, 10:14am UTC](https://discuss.elastic.co/t/can-check-data-type-before-output/67452/2 "2016-11-29T10:14:15Z")

</div>

You'll have to use a ruby filter for this, and then standard Ruby constructs for checking the type of objects will apply.

---

<div class="post-metadata">

**Author:** ![tao\_hiko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tao_hiko/32/707_2.png) [@tao\_hiko](https://discuss.elastic.co/u/tao_hiko)\
**Post date:** [November 29, 2016, 10:17am UTC](https://discuss.elastic.co/t/can-check-data-type-before-output/67452/3 "2016-11-29T10:17:49Z")

</div>

Thank for your suggestion.

I'm looking on this page [https://www.elastic.co/guide/en/logstash/current/plugins-filters-ruby.html](https://www.elastic.co/guide/en/logstash/current/plugins-filters-ruby.html) but I cannot find which's one can be applied for my case.

I'm not familiar with ruby so I need your advice more.

Thanks again.

---

<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 27, 2016, 10:18am UTC](https://discuss.elastic.co/t/can-check-data-type-before-output/67452/4 "2016-12-27T10:18:05Z")

</div>

Closed on December 27, 2016, 10:18am UTC

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