# How to have a boolean based field migrated from MongoDB to Elasticsearch using Logstash?

**URL:** <https://discuss.elastic.co/t/how-to-have-a-boolean-based-field-migrated-from-mongodb-to-elasticsearch-using-logstash/164589>\
**Category:** Logstash\
**Created:** [January 17, 2019, 8:34am UTC](https://discuss.elastic.co/t/how-to-have-a-boolean-based-field-migrated-from-mongodb-to-elasticsearch-using-logstash/164589 "2019-01-17T08:34:58Z")\
**Posts on this page:** 2\
**Page:** 2

<div class="post-metadata">

**Author:** ![guyboertje](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/guyboertje/32/31592_2.png) [@guyboertje](https://discuss.elastic.co/u/guyboertje)\
**Post date:** [January 17, 2019, 11:40am UTC](https://discuss.elastic.co/t/how-to-have-a-boolean-based-field-migrated-from-mongodb-to-elasticsearch-using-logstash/164589/21 "2019-01-17T11:40:58Z")

</div>

You will need to edit the mongodb input plugin ruby code in your logstash installation.

it will be in `E:\Elasticsearch\logstash-6.5.4\vendor\bundle\jruby\2.3.0\gems\logstash-input-mongodb-0.4.1\lib\logstash\inputs\mongodb.rb`

you need to go to line 294 (a blank line) and paste the snippet below into the blank line.

```auto
                elsif v.is_a?(TrueClass) || v.is_a?(FalseClass)
                  event.set(k.to_s, v)

```

With ^ this change you don't need mutate/convert (boolean) on any boolean fields any more.

---

<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:** [February 14, 2019, 11:41am UTC](https://discuss.elastic.co/t/how-to-have-a-boolean-based-field-migrated-from-mongodb-to-elasticsearch-using-logstash/164589/22 "2019-02-14T11:41:03Z")

</div>

Closed on February 14, 2019, 11:41am UTC

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

[Previous page](https://discuss.elastic.co/t/how-to-have-a-boolean-based-field-migrated-from-mongodb-to-elasticsearch-using-logstash/164589.md?page=1)
