Can anyone help me identify why the setup below does not work with document_id.
Context of my configuration, I am importing data from a relational database so I need the sync id.
output {
stdout {
codec => rubydebug
}
if "jdbc" in [tags] {
elasticsearch {
hosts => [ "http://elasticsearch:9200" ]
user => elastic
password => "${elastic_password}"
index => "basa-banklink-%{type}"
document_id => "%{id_sync}"
manage_template => true
template => "/etc/logstash/template-index/basa/banklink/basa-banklink.json"
template_name => "basa-banklink"
template_overwrite => "true"
}
}
else if "beats" in [tags] {
elasticsearch {
hosts => [ "http://elasticsearch:9200" ]
user => elastic
password => "${elastic_password}"
index => "basa-banklink-%{type}"
}
}
else {
elasticsearch {
hosts => [ "http://elasticsearch:9200" ]
user => elastic
password => "${elastic_password}"
index => "basa-banklink-%{type}"
}
}
}
Output from stdout to above configuration:
{
"cendsc" => "TEXTO 000",
"@timestamp" => 2019-01-22T10:28:09.239Z,
"type" => "cen",
"id_sync" => 330,
"datref" => nil,
"cencod" => 330,
"@version" => "1"
}
When I use the configuration below, it works perfectly:
output {
stdout {
codec => rubydebug
}
elasticsearch {
hosts => [ "http://elasticsearch:9200" ]
user => elastic
password => "${elastic_password}"
index => "basa-banklink-%{type}"
document_id => "%{id_sync}"
manage_template => true
template => "/etc/logstash/template-index/basa/banklink/basa-banklink.json"
template_name => "basa-banklink"
template_overwrite => "true"
}
}