CREATE INDEX ix1 ON default(DISTINCT ARRAY [v.val.type, v.name] FOR v IN OBJECT_PAIRS(sites) END) WHERE type = "blah";
SELECT * FROM default
WHERE type = "blah" AND ANY v IN OBJECT_PAIRS(sites) SATISFIES [v.val.type, v.name] = ["building","B1"] END;
Equality is simple all others are complex and special care must have been taken.
For trailing %, name LIKE “BD%” nothing but name >= “BD” AND name < “BE”
SELECT * FROM default
WHERE ANY v IN OBJECT_PAIRS(sites) SATISFIES [v.val.type, v.name] >= ["building","B"] AND [v.val.type, v.name] < ["building", SUCCESSOR("B")] END;