# Elastic search index is getting created as BSON instead of JSON

**URL:** https://discuss.elastic.co/t/elastic-search-index-is-getting-created-as-bson-instead-of-json/185222
**Category:** Logstash
**Created:** [June 11, 2019, 2:54pm UTC](https://discuss.elastic.co/t/elastic-search-index-is-getting-created-as-bson-instead-of-json/185222 "2019-06-11T14:54:29Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![nagarajanj](https://avatars.discourse-cdn.com/v4/letter/n/a8b319/32.png) [@nagarajanj](https://discuss.elastic.co/u/nagarajanj)
#### Post date: [June 11, 2019, 2:54pm UTC](https://discuss.elastic.co/t/elastic-search-index-is-getting-created-as-bson-instead-of-json/185222/1 "2019-06-11T14:54:29Z")

</div>

We are using logstash to move the data b/w mongo db and elastic.. however the  
data is getting created as BSON instead of JSON..

I keep getting all the data in a "log\_entry" field as one big string.

when we do the same from S3 to elastic using logstash , the data is coming correctly as the JSON.

Our issue is exactly same as the below reported issue..

> [@Formatting issues with parsing JSON from MongoDB](https://discuss.elastic.co/t/formatting-issues-with-parsing-json-from-mongodb/150847):
>
> I am trying to parse JSON (from MongoDB) to Kibana through Logstash. I keep getting all the data in a "log\_entry" field. This field does not exist in my data but rather is being created by Logstash. In my CONF file, I have my filter empty. I have tried adding JSON with source as a specific field but that does not work either. Any ideas?

Please advise..

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [June 11, 2019, 3:43pm UTC](https://discuss.elastic.co/t/elastic-search-index-is-getting-created-as-bson-instead-of-json/185222/2 "2019-06-11T15:43:45Z")

</div>

> [@nagarajanj](#):
>
> I keep getting all the data in a "log\_entry" field as one big string.

That is what the mongodb input does. That is not an elastic supported input.

If I had to deal with that I would install the [bson](https://rubygems.org/gems/bson/versions/4.5.0-java) gem (see [here](https://github.com/elastic/logstash/issues/7016) for how to do that and why it is a bad idea), then repurpose some [IBM code](https://www.ibm.com/developerworks/community/blogs/zTPF/entry/Using_logstash_with_MongoDB_Logging_for_z_TPF_PJ44239?lang=en) to do the BSON =\> JSON conversion in a ruby filter.

If you can get that working it would be interesting to see.

---

<div class="post-metadata">

### Author: ![nagarajanj](https://avatars.discourse-cdn.com/v4/letter/n/a8b319/32.png) [@nagarajanj](https://discuss.elastic.co/u/nagarajanj)
#### Post date: [June 12, 2019, 9:54pm UTC](https://discuss.elastic.co/t/elastic-search-index-is-getting-created-as-bson-instead-of-json/185222/3 "2019-06-12T21:54:22Z")

</div>

Thanks a lot for your inputs..let me try this..

---

<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: [July 10, 2019, 9:54pm UTC](https://discuss.elastic.co/t/elastic-search-index-is-getting-created-as-bson-instead-of-json/185222/4 "2019-07-10T21:54:24Z")

</div>

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