Hi all,
In Couchbase v5.5, we have the following documents in our bucket test_bucket:
{
"type": "type_1",
"outerArray": [
{
"innerArray": [
{
"idItem": 25,
"relevance": 60
},
{
"idItem": 46,
"relevance": 70
}
]
},
{
"innerArray": [
{
"idItem": 10,
"relevance": 45
},
{
"idItem": 99,
"relevance": 100
}
]
}
]
}
Our query is this:
SELECT meta(b).id
FROM test_bucket b
WHERE ANY o IN b.outerArray SATISFIES
ANY i IN o.innerArray SATISFIES
i.idItem IN [25, 46] AND i.relevance >= 50
END
END
We tried this index that does not cover the previous query:
CREATE INDEX idx ON test_bucket(DISTINCT ARRAY (DISTINCT ARRAY [i.idItem, i.relevance] FOR i IN o.innerArray END) FOR o IN outerArray END)
Please, can you tell us how to create a covering index for this query?