I have an issue regarding of the creating GSI for array,
right now, I have those array in my document:
{'tags':['tag1','tag2']}
and I want use this query to search all of the documents contains one of the string in this array:
SELECT * FROM
Bucket_nameWHERE _type='Test' AND ANY t in tags SATISFIES t='Tag1' END;
To enhance the performance, I want to use the GSI:
CREATE INDEX Test_index_Tag ON
Bucket_name(tags) WHERE _type='Test' USING GSI;
But after I created this index, the query execution time still the same. any ides?
Hi there @zzkkyy1000, at the moment, when we index tag in GSI we are indexing the full array so you can use the index for a query like the following which would search for an exact match to the array.
SELECT * FROM Bucket_name WHERE _type=‘Test’ AND tags=[‘tag1’,‘tag2’];
We are building a new capability that will iterate over the array elements and optimize the ANY t IN tags clause you have above. If you’d like to get a preview of plans on the new array indexes, feel free to reach out at cihan@couchbase.com and I 'd be happy to walk you through the details.
thanks
-cihan
got it, thank you very much! looking forward to the new features
is there any references how to use array indexing in the preview? thanks a lot