Hello,
I have a need to index a document, with a field that computes by adding a number to an old document's field value.
For example, I had a document (id: zoneA_userA).
{
"_index": "online",
"_type": "duration",
"_id": "zoneA_userA",
...
"_source": {
"zone": "zoneA",
"aggTimeSec": "1355",
...
}
}
And I continuously receive numbers of logs saying additional online time of userA in zoneA. (Format: <user> <zone> <sec>
)
userA zoneA 29
I want to add value <sec>
to the document's aggTimeSec
value and update the document.
Now I use logstash's elasticsearch filter to query the document, and output to same document id. This works but I wonder if this is best practice? Can I do it without querying ES from logstash? I persume the flow of logstash querying elasticsearch before output is too much time load and largely degrade logstash's performance.
Regards,
Michael