Hello,
I'm confused by why the Elasticsearch output is getting an Integer field as String. The effect I'm getting is that when I tryh to increment this field, it appends the incremental value (1) to the end of the field's value.
Thank you for your help
Elasticsearch mapping, forcing the field to be an Integer:
{
"settings": {
"index": {
"mapping": {
"total_fields.limit": 2000
}
}
},
"mappings": {
"_doc": {
"properties": {
"qtdEventos": {
"type": "integer"
}
}
}
}
}
Field initialization in Logstash (relevant part)...:
mutate {
add_field => {
"qtdEventos" => 0
}
# I don't know if this is necessary... just trying anything to get thi to work
convert => {
"qtdEventos" => "integer"
}
}
Output to Elasticsearch:
elasticsearch {
hosts => ["vmsrv103:9200"]
index => "nfe"
document_type => "_doc"
document_id => "%{id}"
action => "update"
doc_as_upsert => true
script_lang => "painless"
script_type => "inline"
script => "ctx._source.qtdEventos += 1;"
}