Hi there, my documents look like this:
{
"id": "xxxx",
"firstLevel": [
{
"levelId": 12,
"secondLevel": [
{
"levelId": 34
},
{
"levelId": 56
}
]
},
{
"levelId": 78,
"secondLevel": [ ]
}
]
}
I want to make this query:
SELECT r.id FROM records r
UNNEST r.firstLevel fl
LEFT UNNEST fl.secondLevel sl
WHERE fl.levelId = 999 OR sl.levelId = 999
I have 100k records, so I need and index, please help to write one