# Logstash doesnt update the data when mongodb data gets updated

**URL:** <https://discuss.elastic.co/t/logstash-doesnt-update-the-data-when-mongodb-data-gets-updated/259562>\
**Category:** Logstash\
**Created:** [December 24, 2020, 8:15am UTC](https://discuss.elastic.co/t/logstash-doesnt-update-the-data-when-mongodb-data-gets-updated/259562 "2020-12-24T08:15:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Siddhanta\_Das](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/siddhanta_das/32/81358_2.png) [@Siddhanta\_Das](https://discuss.elastic.co/u/Siddhanta_Das)\
**Post date:** [December 24, 2020, 8:15am UTC](https://discuss.elastic.co/t/logstash-doesnt-update-the-data-when-mongodb-data-gets-updated/259562/1 "2020-12-24T08:15:25Z")

</div>

I am using this configuration

```auto
input{
mongodb{
	uri=>"mongodb://localhost:27017/ebyat"
	placeholder_db_dir => "/opt/logstash-mongodb/"
	placeholder_db_name => "logstash_sqlite.db"
	collection => "amenities"
	batch_size => 5000
	dig_fields => ["property_ids"]
}
}
filter{
	mutate{
		remove_field=>["_id"]
	}
}
output{
	stdout{
		codec => rubydebug{
				metadata => true
			}
	}
	elasticsearch{
		action => "update"		
		index => "ebyat_amenities"
		hosts => ["localhost:9200"]
		document_id => "%{amenity}"
	}
}

```

Can anyone say what i am doing wrong?  
Thanks In Advance

---

<div class="post-metadata">

**Author:** ![fadjar340](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fadjar340/32/43610_2.png) [@fadjar340](https://discuss.elastic.co/u/fadjar340)\
**Post date:** [December 25, 2020, 8:42am UTC](https://discuss.elastic.co/t/logstash-doesnt-update-the-data-when-mongodb-data-gets-updated/259562/2 "2020-12-25T08:42:18Z")

</div>

Try to change the `document_id` with this:

```auto
	elasticsearch{
		action => "update"		
		index => "ebyat_amenities"
		hosts => ["localhost:9200"]
		document_id => "%{property_ids}"
	}

```

Because if no more value for `amenities` the document will not added because the same `document_id`  
If you use `property_ids` it means if new `property_ids` as your documents added, the `document_id` will create new one.

---

<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:** [January 22, 2021, 8:42am UTC](https://discuss.elastic.co/t/logstash-doesnt-update-the-data-when-mongodb-data-gets-updated/259562/3 "2021-01-22T08:42:20Z")

</div>

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