Create GSI for indexing the string in array

I have an issue regarding of the creating GSI for array,
right now, I have those array in my document:


and I want use this query to search all of the documents contains one of the string in this array:

SELECT * FROMBucket_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 ONBucket_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 and I 'd be happy to walk you through the details.


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

Here is links to documentation and blogs on array indexing in 4.5:…-with-array-indexing…-with-covering-array-indexes-and-more

Happy array indexing !!

1 Like