ElasticSearch Index Overlay / Storing and Aggregating against different version states

(Elmar Weber) #1

I'm looking at a solution to overlay different indexes that have the same document but in different versions. And depending on the type of query I am querying against a certain version of the documents.

To explain it in a simple example. About 5% of the documents have a preview version that contains updated data compared to the active version of the document. Depending on the use case, aggregation queries either have to go against all the old documents to report the correct data, or they go against 90% of the old documents that do not have a preview version and for the other 5% the preview version data is used.

The only way I see how to solve this is to keep two indices (current, preview) and copy the ones that don't have a preview version into both. The problem is obvious, as this will require massively more disk space / resources, especially as the actual setup requires up to 20 different layers of this.

I have not found a way to query the two indices so that they overlay I can just have a copy of the preview version instead of all the data.

I thought about putting the versions into one document, but there I also don't see a way to select the "right" version different per document.

Is there any approach that I missed?

(system) #2