Hi!
I'm trying to add new fields in my index documents which are calculated from data already present in the documents. For example, I have two timestamps and I have to calculate the difference in seconds.
I wrote a logstash configuration file that take data from elatsicserach index and put the output updating documents.
It seems that the routine doesn't start, even if I've specified the tag schedule or scroll (not both of them).
This is imy input:
input {
elasticsearch {
hosts => "my_host:9200"
index => "my_index*"
query => '{ "query": { "bool": { "filter": [ { "exists": { "field": "time_closed" } }, { "exists": { "field": "time_open" } }, { "match_phrase": { "calc_done": false } }, { "range": { "@timestamp": { "gt": "now-3d", "lt": "now" } } } ] } } }'
tags => ["my_tag"]
# schedule => "30 * * * *"
user => "my_elastic_user"
password => "my_elastic_password"
scroll => "10m"
size => 10000
docinfo => true
}
}
I tried the query in a curl request, it returns every documents that I expect.
This is my input:
filter {
if "my_tag" in [tags] {
.. some calculation
mutate {
replace => {
"[calc_done]" => true
}
}
}
}
This is my output:
output {
if "my_tag" in [tags] {
elasticsearch {
hosts => [ "http://my_host:9200" ]
user => "my_logstash_user"
password => "my_logstash_password"
index => "%{[@metadata][_index]}"
action => "update"
doc_as_upsert => true
document_id => "%{[@metadata][_id]}"
}
}
}
I don't see any log for this routine in logstash and elasticserach log file...
In every documents the file "calc_done" is false and no calculations are done...
Thanks in advance
Giacomo