The following N1QL Query works in Community Edition 5.0.1 build 5003 but stops working in 5.5.1 which we are just testing.
select meta(
variant).id, variant.parent_id from
datastoreitemsvariant LEFT JOIN
datastoreitems parent ON KEYS variant.parent_id WHERE variant.datastore_id = 'rVY' AND variant.customer_id = '3d50db41-b800-11e8-a9de-2614d88ffdfc' AND parent IS MISSING
in 5.5.1. we get the following error:
Code=12008
Error performing bulk get operation - cause: MCResponse status=EINVAL, opcode=GET, opaque=0, msg: "
The query console also shows a yellow exclamation mark with the message in the screenshot:
This query contains the following fields not found in the inferred schema for their bucket, the field names might be misspelled: datastoreitems.id
EXPLAIN:
{
"plan": {
"#operator": "Sequence",
"~children": [
{
"#operator": "IntersectScan",
"scans": [
{
"#operator": "IndexScan3",
"as": "variant",
"index": "idx_flowrunid",
"index_id": "4f6f0542a4f89052",
"index_projection": {
"primary_key": true
},
"keyspace": "datastoreitems",
"namespace": "default",
"spans": [
{
"exact": true,
"range": [
{
"high": "\"rVY\"",
"inclusion": 3,
"low": "\"rVY\""
}
]
}
],
"using": "gsi"
},
{
"#operator": "IndexScan3",
"as": "variant",
"index": "idx_customer",
"index_id": "d93401a00a117a00",
"index_projection": {
"primary_key": true
},
"keyspace": "datastoreitems",
"namespace": "default",
"spans": [
{
"exact": true,
"range": [
{
"high": "\"3d50db41-b800-11e8-a9de-2614d88ffdfc\"",
"inclusion": 3,
"low": "\"3d50db41-b800-11e8-a9de-2614d88ffdfc\""
}
]
}
],
"using": "gsi"
}
]
},
{
"#operator": "Fetch",
"as": "variant",
"keyspace": "datastoreitems",
"namespace": "default"
},
{
"#operator": "Join",
"as": "parent",
"keyspace": "datastoreitems",
"namespace": "default",
"on_keys": "(`variant`.`parent_id`)",
"outer": true
},
{
"#operator": "Parallel",
"~child": {
"#operator": "Sequence",
"~children": [
{
"#operator": "Filter",
"condition": "((((`variant`.`datastore_id`) = \"rVY\") and ((`variant`.`customer_id`) = \"3d50db41-b800-11e8-a9de-2614d88ffdfc\")) and (`parent` is missing))"
},
{
"#operator": "InitialProject",
"result_terms": [
{
"expr": "(meta(`variant`).`id`)"
},
{
"expr": "(`variant`.`parent_id`)"
}
]
},
{
"#operator": "FinalProject"
}
]
}
}
]
},
"text": "select meta(`variant`).id, variant.parent_id from `datastoreitems` variant LEFT JOIN `datastoreitems` parent ON KEYS variant.parent_id WHERE variant.datastore_id = 'rVY' AND variant.customer_id = '3d50db41-b800-11e8-a9de-2614d88ffdfc' AND parent IS MISSING"
}
Related indexes:
CREATE INDEX
idx_datastore_parentidON
datastoreitems(
parent_id,
datastore_id) WITH { "defer_build":true }
CREATE INDEX
idx_variantids_lengthON
datastoreitems(object_length(ifmissingornull(
variantids, {}))) WHERE (
parent_id = "") WITH { "defer_build":true }
CREATE INDEX
idx_datastoreON
datastoreitems(
datastore_id,
folder) WITH { "defer_build":true }
CREATE INDEX
idx_customerON
datastoreitems(
customer_id) WITH { "defer_build":true }
Any ideas?