N1QL - Array with Function Base Index

both in create index and query it needs flt.day because day coming from flt.

create index index2 on `travel-sample`(distinct array [flt.day, lower(flt.flight)] for flt in schedule END)
 where type = "route";
select * from `travel-sample` use index (index2 using gsi) 
where (any flt in schedule satisfies [flt.day, lower(flt.flight)] = [0, "as783"] END) and type = "route";

The strategy used above can be used doing array comparison and you can’t use for LIKE. LIKE can be used only on strings.

If you use following IndexScan done on wide range of keys but also applying on individually it eliminates any false positives.

x LIKE "as7%"  means  x >="as7" AND  x < "as8"
x >=  like_prefix("as7%") AND x <  like_stop("as7%")
select like_prefix("as7%"), like_stop("as7%");

select * from `travel-sample` use index (index2 using gsi)
 where (any flt in schedule satisfies [flt.day, lower(flt.flight)] >=  [0, "as7"] AND  [flt.day, lower(flt.flight)] <  [0,"as8"] AND flt.day = 0 AND lower(flt.flight) LIKE  "as7%" END) and type = "route";

As array index can be used as single key index you can index one key from array others can be appiled post index scan.

 create index index2 on `travel-sample`(distinct array lower(flt.flight) for flt in schedule END)
     where type = "route";
    select * from `travel-sample` use index (index2 using gsi) 
    where (any flt in schedule satisfies flt.day= 0 AND  lower(flt.flight) LIKE "as7%" END) and type = "route";