History of updates modeling

I'm newbie to Elasticsearch and I'm wondering about the best way to model this requirement in Elasticsearch: we need to keep the modification history of an object like this:

example{
id;
name;
type;
}

So far, we've followed this approach: every time the object is modified, a new document is inserted into Elasticsearch. I also need to create ratio metrics on the type within a period, considering only the last document of each object within that period, based on a date field added to the object. This makes the query complicated and involves several sub-aggregations.

Have you considered having 2 separate indices - one in which you always store the latest version by performing an update and one where you store each update as a separate document? If you want the current version you efficiently query the first index and if you are looking at changes over time you query the second.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.