CREATE INDEX Last_nm_idx18 on csrt
(ALL DISTINCT array substr(Lower(lst_nm),i,4) for i in array_range(0,length(Lower(lst_nm))-3,1) end)
where meta().id like ‘CX%’ USING GSI;
what this essentially does is , It takes the last name field . breaks it and indexes it
example
Hemanth will be
[ hema, eman , mant ,anth ]
this will be indexed as as array index .
But when i try to write a query that invokes it the indexes is not getting invoked .
The below SQL is invoking only primary indexes .
select * from
csrt
where
any v in array substr(Lower(lst_nm),i,4) for i in array_range(0,length(Lower(lst_nm))-3,1) end SATISFIES v = ‘dill’ end
and meta().id like ‘CX%’ ;
CREATE INDEX Last_nm_idx18 ON csrt
(ALL DISTINCT ARRAY SUBSTR(LOWER(lst_nm),i,4) FOR i IN ARRAY_RANGE(0,LENGTH(lst_nm)-3,1) END)
WHERE META().id LIKE "CX%" USING GSI;
SELECT *
FROM csrt
WHERE META().id LIKE "CX%"
AND ANY i IN ARRAY_RANGE(0,LENGTH(lst_nm)-3,1) SATISFIES SUBSTR(LOWER(lst_nm),i,4) = "dill" END;