I'm using ElasticSearch (OpenSearch) to store multiple objects in an index. Each object has a unique ID, creation date and an "amount" field that stores integer value. This "amount" value changes periodically, so I'm updating objects in-place using the IDs to match the existing objects.
What I want is to display a histogram of total amount across all objects over time. The problem is that I need to preserve historical data somehow in order for it to be displayed on the graph.
What are my option to implement this? Is there an automatic way to aggregate and preserve these totals? Or should I do this manually from my application? E.g. send these totals instead of individual objects?
The data structure:
[
{ id: '{uuidv4}', amount: 100 },
{ id: '{uuidv4}', amount: 25 },
{ id: '{uuidv4}', amount: 150 },
{ id: '{uuidv4}', amount: 0 },
...
]