Mapping/querying question for array of nested object


(Roly Vicaria) #1

Hi,

Currently, my document structure looks something like this:

{
"localizedStr" : [
{"en-us" : "someValue"},
{"es-es" : "algunValor"},
....
]
}

I have explicitly included in my mapping every possible culture-locale that
we currently support. My fear is that when we add more to the system, I
have to update my mapping.

This led me to consider an alternative document structure:

{
"localizedStr" : [
{ "culture" : "en-us", "value" : "someValue"},
{ "culture" : "es-es", "value" : "algunValor"},
...
]
}

With this structure I know I can easily add more cultures to the system
without having to change my mapping, but I'm not exactly sure how I can
query for a value in a specific culture-locale.
For example: if I were to query for localizedStr.culture : "en-us" AND
localizedStr.value : "algunValor", this document would be returned,
although that's not what I want.

Can someone provide some input on which of these makes most sense? If it's
the second one, then how do I query values for a specific culture-locale?

Thanks.


(system) #2