# What is the best way of getting MongoDB data into Elasticsearch?

**URL:** <https://discuss.elastic.co/t/what-is-the-best-way-of-getting-mongodb-data-into-elasticsearch/40840>\
**Category:** Elasticsearch\
**Created:** [February 3, 2016, 8:49am UTC](https://discuss.elastic.co/t/what-is-the-best-way-of-getting-mongodb-data-into-elasticsearch/40840 "2016-02-03T08:49:47Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![wozza.lowe](https://avatars.discourse-cdn.com/v4/letter/w/779978/32.png) [@wozza.lowe](https://discuss.elastic.co/u/wozza.lowe)\
**Post date:** [February 3, 2016, 8:49am UTC](https://discuss.elastic.co/t/what-is-the-best-way-of-getting-mongodb-data-into-elasticsearch/40840/1 "2016-02-03T08:49:47Z")

</div>

Hi All,

Now that rivers are being deprecated, I need a more future proof easy way of replicating MongoDB data to our Elasticsearch cluster, what would be the best solution for this?

We don't need to transform the data before storing it in Elasticsearch, for now we just want to index everything. I definitely want to avoid baking stuff into our code and re-inventing wheels.

Thanks  
Warren.

---

<div class="post-metadata">

**Author:** ![edeak](https://avatars.discourse-cdn.com/v4/letter/e/a698b9/32.png) [@edeak](https://discuss.elastic.co/u/edeak)\
**Post date:** [February 3, 2016, 10:10am UTC](https://discuss.elastic.co/t/what-is-the-best-way-of-getting-mongodb-data-into-elasticsearch/40840/2 "2016-02-03T10:10:58Z")

</div>

I think you can do it with logstash.  
It has a plugin for mongodb as input, and elasticsearch can be configured as output.  
The other way is what you want to avoid I guess - in this case you can create a small application which loads records from mongodb and inserts them into elasticsearch through the bulk API.

---

<div class="post-metadata">

**Author:** ![wozza.lowe](https://avatars.discourse-cdn.com/v4/letter/w/779978/32.png) [@wozza.lowe](https://discuss.elastic.co/u/wozza.lowe)\
**Post date:** [February 3, 2016, 10:42am UTC](https://discuss.elastic.co/t/what-is-the-best-way-of-getting-mongodb-data-into-elasticsearch/40840/3 "2016-02-03T10:42:39Z")

</div>

Thanks. These do seem to be the 2 best options.  
We're not currently using logstash at all, but I have been considering introducing it to our infrastructure for other purposes, this would be "better" solution. However, developing a small application would probably be the quickest and easiest for now.  
W.

---

<div class="post-metadata">

**Author:** ![JuHwon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/juhwon/32/596_2.png) [@JuHwon](https://discuss.elastic.co/u/JuHwon)\
**Post date:** [February 3, 2016, 11:20am UTC](https://discuss.elastic.co/t/what-is-the-best-way-of-getting-mongodb-data-into-elasticsearch/40840/4 "2016-02-03T11:20:55Z")

</div>

What about mongo-connector?

> **[mongodb-labs/mongo-connector](https://github.com/mongodb-labs/mongo-connector)**
>
> mongo-connector - Data replication from MongoDB to MongoDB, Elasticsearch, Solr, and more!

It currently does not work with Elasticsearch 2.x though they are working on it.

The logstash input plugin is currently not listed in the logstash docs. Why is this?

---

<div class="post-metadata">

**Author:** ![wozza.lowe](https://avatars.discourse-cdn.com/v4/letter/w/779978/32.png) [@wozza.lowe](https://discuss.elastic.co/u/wozza.lowe)\
**Post date:** [February 3, 2016, 11:32am UTC](https://discuss.elastic.co/t/what-is-the-best-way-of-getting-mongodb-data-into-elasticsearch/40840/5 "2016-02-03T11:32:59Z")

</div>

I looked at the mongo-connector, just wasn't sure if this was going to be particularly future proof. It's definitely another option though, thanks!

It's doing doing what the river plugin does, and has GridFS support, which is good.

Regarding the logstash input plugin for MongoDB, there isn't an official one, only for output.

---

<div class="post-metadata">

**Author:** ![Sriharsha\_Pothukuchi](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sriharsha\_Pothukuchi](https://discuss.elastic.co/u/Sriharsha_Pothukuchi)\
**Post date:** [March 4, 2016, 11:07am UTC](https://discuss.elastic.co/t/what-is-the-best-way-of-getting-mongodb-data-into-elasticsearch/40840/6 "2016-03-04T11:07:33Z")

</div>

Hi Warren

Thanks for asking this question. Can you let me know which solution looks better and have you started implementing this?

Thanks  
Sri Harsha

---

<div class="post-metadata">

**Author:** ![wozza.lowe](https://avatars.discourse-cdn.com/v4/letter/w/779978/32.png) [@wozza.lowe](https://discuss.elastic.co/u/wozza.lowe)\
**Post date:** [May 20, 2016, 8:52am UTC](https://discuss.elastic.co/t/what-is-the-best-way-of-getting-mongodb-data-into-elasticsearch/40840/7 "2016-05-20T08:52:55Z")

</div>

Hi Sri,

I've been experimenting with the mongo-connector, seems to work quite well. I have it running and indexing our data in the simplest possible way.

We've built a basic sandbox on top of our elastic search server (because we're not running Kibanna) to validate what's being indexed.

The next step is finalise our API for access controlled searches, and potentially change slightly what we're indexing so that our API implementation is as clean as it can possibly be.

Opted for the mongo-connector in the end because I didn't want to re-invent any wheels. Hoping there will be an official MongoDB input plugin soon.

Kind Regards  
Warren.

---

<div class="post-metadata">

**Author:** ![indatawetrust](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/indatawetrust/32/31129_2.png) [@indatawetrust](https://discuss.elastic.co/u/indatawetrust)\
**Post date:** [May 17, 2017, 9:39pm UTC](https://discuss.elastic.co/t/what-is-the-best-way-of-getting-mongodb-data-into-elasticsearch/40840/8 "2017-05-17T21:39:14Z")

</div>

I wrote a simple tool. Maybe it will work.

[https://github.com/indatawetrust/mongo-to-elastic](https://github.com/indatawetrust/mongo-to-elastic)

---

<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 5, 2017, 10:00pm UTC](https://discuss.elastic.co/t/what-is-the-best-way-of-getting-mongodb-data-into-elasticsearch/40840/9 "2017-07-05T22:00:19Z")

</div>


