# Logstash not updating record and not giving any error

**URL:** <https://discuss.elastic.co/t/logstash-not-updating-record-and-not-giving-any-error/216977>\
**Category:** Logstash\
**Created:** [January 29, 2020, 10:16am UTC](https://discuss.elastic.co/t/logstash-not-updating-record-and-not-giving-any-error/216977 "2020-01-29T10:16:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![saifrehman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/saifrehman/32/56971_2.png) [@saifrehman](https://discuss.elastic.co/u/saifrehman)\
**Post date:** [January 29, 2020, 10:16am UTC](https://discuss.elastic.co/t/logstash-not-updating-record-and-not-giving-any-error/216977/1 "2020-01-29T10:16:28Z")

</div>

Logstash not updating documents. I am not receiving any error . Here is my code.

```
    input{
jdbc {
jdbc_connection_string => "-------" 
jdbc_user => "------" 
jdbc_password => "-----" 
jdbc_validate_connection => true 
jdbc_driver_library => "/mysql-connector-java-5.1.36-bin.jar" 
jdbc_driver_class => "com.mysql.jdbc.Driver" 

charset=>"UTF-8"
jdbc_default_timezone => "UTC"
schedule => "* * * * * *"
parameters => { "object_id" => 265636 }
statement => "------------" 

use_column_value => true 
tracking_column => "updated_timestamp" 
tracking_column_type => "timestamp"

last_run_metadata_path => "logstash_post_sync_jdbc_last_run" 
}}filter {
aggregate {
	task_id => "%{box_id}"
	code => "
	map['box_posts'] ||= []
	map['box_posts'] << {
		'id' => event.get('id'),
		'post_box_id' => event.get('post_box_id'),
		'post_type_id' => event.get('post_type_id'),
		'created_at' => event.get('created_at'),
		'user_id' => event.get('user_id'),				
		'score' => event.get('score'),
		'text_content' => event.get('text_content'),
		'short_code' => event.get('short_code')
	}
	event.cancel()"
	push_previous_map_as_event => true
		
} }output {
stdout { codec => rubydebug }
elasticsearch {
    "document_id" => "%{box_id}"
    "hosts" => "http://127.0.0.1:9200"
    "action" =>"update"
    "index" => "test"
    "document_type" => "_doc"
    "routing" => 1
    "doc_as_upsert" => true
}}'

```

Please help!

---

<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:** [January 29, 2020, 3:02pm UTC](https://discuss.elastic.co/t/logstash-not-updating-record-and-not-giving-any-error/216977/2 "2020-01-29T15:02:32Z")

</div>

> [@saifrehman](#):
>
> Logstash not updating documents. I am not receiving any error .

That would happen if all the events had the same value for box\_id. Verify that this changes by reviewing the output from stdout.

---

<div class="post-metadata">

**Author:** ![saifrehman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/saifrehman/32/56971_2.png) [@saifrehman](https://discuss.elastic.co/u/saifrehman)\
**Post date:** [January 30, 2020, 6:29am UTC](https://discuss.elastic.co/t/logstash-not-updating-record-and-not-giving-any-error/216977/3 "2020-01-30T06:29:36Z")

</div>

I am only updating one single nested filed of a document.

---

<div class="post-metadata">

**Author:** ![saifrehman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/saifrehman/32/56971_2.png) [@saifrehman](https://discuss.elastic.co/u/saifrehman)\
**Post date:** [February 3, 2020, 7:29am UTC](https://discuss.elastic.co/t/logstash-not-updating-record-and-not-giving-any-error/216977/4 "2020-02-03T07:29:09Z")

</div>

I have fixed it. The document\_id should be present in query, filters, also output. if we remove the field in filter/aggregate or override it then it would not work.

---

<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:** [March 2, 2020, 7:29am UTC](https://discuss.elastic.co/t/logstash-not-updating-record-and-not-giving-any-error/216977/5 "2020-03-02T07:29:09Z")

</div>

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