How to discount index who change from a Transform

I have a specific task and we decided to solved it using transform

  • Our Case:
    We need to count and aggregate by status a index
    like this
      created_at: "2023-01-15"
      review: 15,

One register for every day.

We reach this using the Transform the problem is we can update the status of the transactions but looks like the Transform is not discounting from the past information only adding when the field we conditioned is modify (updated_at)

There is some way for also discount from the past counts.

Can you explain how a "discount" is implemented in the source index? How do the documents look like that you ingest? It would also help if you can share relevant parts of the transform config.

We have a specific problem, a group of transactions and their status can change on the time for example past from "on review" to "accepted" so we calculate a transform who counts this status for all transactions.

Our problem is when we update one status for example "on review" past to be "accepted" the transform update the row of count in "accepted" but don't discount -1 to the row of "on review"

Here is some Screens of the configuration for my transform

This is how looks my index after I start the transform

And after Update the status of the review transaction to "success" it increase one to success but not reduce the count in review.

Does accepted always contain review?
If I get it right, you want to deduct accepted from review. You can do this using an ingest pipeline that you attach to the transform output. In the ingest pipeline I would set review to review - accepted, e.g. using a script processor.

Another alternative I can think of is using a runtime field that you specify on the transform destination.