Let me clearly explain the scenario,
Hi,
i have the documents in source index like
document 1: duration :10, callstatus : open, id : id1
document 2 : duration :15, callstatus : open, id : id1
document 3 : duration :20, callstatus: closed, id: id1
document 4: duration :10, callstatus : open, id : id2
document 5 : duration :15, callstatus : open, id : id2
now i run the transform to get the number of open calls for each 5 sec,
now i run the transform using scripted metric i calculate the number of open calls., it would give 1 call and create index as a document timestamp, noofopencalls,
2nd time i ran and the document is over written as same as no new record, or the transform will not run as no new record.
now new record came as
document 6 : duration :15, callstatus : closed, id : id2
now 3rd time the transform run and the document is over written, as no of calls as 0,
in this case i need the documents for each 5s, when the transform runs. to taol 3 documents in new index, but it is having anytime the document will be one as it is updating same document,
i cannot do group by 5s, as it consider the documents only in the time window and it will not give the result that number of open calls ( to calculate this need to consider previous records also)
Expected result in destination index is
documnet 1: timestamp : xx-xx-xxxx:xx, noofcalls:1
documnet 2: timestamp : xx-xx-xxxx:xx, noofcalls:1
documnet 3: timestamp : xx-xx-xxxx:xx, noofcalls:0