Hi,
Below is one of my where I am trying to use ANSI join.
I followed https://blog.couchbase.com/ansi-join-support-n1ql/ to implement ANSI JOIN
SELECT REGEX_REPLACE(p.place_name, “\<[^>]*>”, “”) AS place_name
FROMpinsAS p USE INDEX(place-been-hereUSING GSI)
INNER JOINassetsAS a USE INDEX(asset-on-pinsUSING GSI)
ON META(p).id = a.pin_id
WHERE p.place_id=‘RXZI4M’ AND p.pin_type=“atlas”
AND p.status=1 LIMIT 10 OFFSET 0;
I am two using Indexes
CREATE INDEX
place-been-hereONpins(place_id,pin_create_dateDESC) WHERE ((pin_type= “atlas”) and (status= 1))
And
CREATE INDEX
asset-on-pinsONassets(pin_id,asset_name,created_on) WHERE (status= 1)
First Index is optional and the second one is mandatory. As it is mentioned in the documentation mandatory index is necessary. But running the above query gives me the following error.
“msg”: “No index available for ANSI join term a”,
As I have mentioned above that I have created mandatory INDEX.
Below Is the sample asset document
{ "created_on": 1546246436, "modified_on": 1546246436, "eloc": "U4LRPQ", "type": "atlas", "source": 101, "asset_name": "c7d371cb912be1da.jpg", "user_id": "1ca1fdddc37a2d6f1f7970c85ab0bcd4", "status": 0, "pin_id": "e724edc792ae8d2fc5cba2ef385a448c" }