MongoDB-Elasticsearch Integration Via Logstash Infinite Loop

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.

What makes you say that?

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