# MongoDB-Elasticsearch Integration Via Logstash Infinite Loop

**URL:** <https://discuss.elastic.co/t/mongodb-elasticsearch-integration-via-logstash-infinite-loop/239460>\
**Category:** Logstash\
**Created:** [July 1, 2020, 10:45am UTC](https://discuss.elastic.co/t/mongodb-elasticsearch-integration-via-logstash-infinite-loop/239460 "2020-07-01T10:45:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![leoper](https://avatars.discourse-cdn.com/v4/letter/l/ce7236/32.png) [@leoper](https://discuss.elastic.co/u/leoper)\
**Post date:** [July 1, 2020, 10:45am UTC](https://discuss.elastic.co/t/mongodb-elasticsearch-integration-via-logstash-infinite-loop/239460/1 "2020-07-01T10:45:25Z")

</div>

Hi everyone.

I am trying to make an integration between MongoDB (Version 4.2.7) and Elasticsearch (Version 7.7.0) via Logstash (Version 7.8.0).  
The goal is to synchronize data from MongoDB to Elasticsearch.

The scenario is as follows:

1. An instance of MongoDB Server on 127.0.0.1:2717;
2. Installation of Logstash and the plug-in for mongoDB logstash-input-mongodb;
3. An instance of Elasticsearch: 127.0.0.1:9200;

Here is the Logstash configuration file:

input  
{  
mongodb  
{  
uri =\> 'mongodb://username:password@localhost:27017/databasename'  
placeholder\_db\_dir =\> 'C:\Logstash-MongoDB'  
placeholder\_db\_name =\> 'logstash\_mongodb.db'  
collection =\> 'collectionname'  
batch\_size =\> 5000  
}  
}  
filter  
{  
}  
output  
{  
elasticsearch  
{  
hosts =\> ["localhost:9200"]  
index =\> "indexname"  
}  
}

Now I would like synchronize **collectionname** MongoDB into index **indexname** Elasticsearch. **collectionname** exists and is non empty on MongoDB while **indexname** exists empty on Elasticsearch.

I run Logstash in this way:

**logstash -f C:\logstash-7.8.0\config\mongodata.conf**

the result is that Logstash loop infinite over the last document inserted into the collection **collectionname** and no documents are synchronized on Elasticsearch. **indexname** always is empty.

Any suggestions are appreciated, leoper.

---

<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:** [July 1, 2020, 4:47pm UTC](https://discuss.elastic.co/t/mongodb-elasticsearch-integration-via-logstash-infinite-loop/239460/2 "2020-07-01T16:47:36Z")

</div>

> [@leoper](#):
>
> the result is that Logstash loop infinite over the last document inserted into the collection **collectionname**

What makes you say that?

---

<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 29, 2020, 4:47pm UTC](https://discuss.elastic.co/t/mongodb-elasticsearch-integration-via-logstash-infinite-loop/239460/3 "2020-07-29T16:47:38Z")

</div>

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