Mapping for versioned K,V pairs

Hi,
I'm trying to come up with a mapping for a document storing versioned custom key value pairs. Eg.

 version : "1" => [{key : "customkey1", value : "val1"}, {key : "customkey2", value : "val2"}..]
version: "2" => [{key : "customkey100", value : "val100"},]..
version: "3" => [{key : "customkey1", value : "valxyz"}]..

Problem statement being I want to be able to search on any of these key values, and only return the key and value set associated with the latest version ie. search for key=customkey2 && value=val2 => return [{key : "customkey1", value : "valxyz"}].
It is also acceptable to return this whole document and I can extract the latest version set via application logic. Is the nested type the only way to go?
TIA

Yes, if you want to search on several fields of an object in a single query, nested field type is the only way to go. I am not very clear how version is modelled? Does a single document contains all versions?

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