My index's documents looks like that:
{
"sku": "1234567890",
"name": "my_name",
"lng:en_AE:name": "my_name_in_AE",
"lng:en_AE:price": 10.99,
"lng:en_BH:name": "my_name_in_BH",
"lng:en_BH:price": 9.99,
"lng:en_QA:name": "my_name_in_QA",
"lng:en_QA:price": 8.99,
}
There are two "types" of fields:
- general/global - like
"sku"
,"name"
. - language based fields, start with perfix:
lng:xx_YY:*
- like"lng:en_AE:name"
.
A user can add his own fields, either general/global ones or language specific.
When we search for the documents, we want to get all general/global fields and one specific language fields:
{
"_source": {
"includes": [
"lng:en_AE:*",
"*"
],
"excludes": [
"lng:*"
]
}
}
The query about doesn't work but my intent was the get exclude all languages different than en_AE
. I don't know all lng
possibilities in advance and I can't change the schema, is there a way to achieve that?
I would like to get that as a response:
{
"sku": "1234567890",
"name": "my_name",
"lng:en_AE:name": "my_name_in_AE",
"lng:en_AE:price": 10.99,
}