Using the travel-sample, here is portion of the route document:
{
"airline": "AS",
"airlineid": "airline_439",
"destinationairport": "PBG",
"distance": 322.6135705757482,
"equipment": "SF3",
"id": 11600,
"schedule": [
{
"day": 0,
"flight": "AS783",
"utc": "22:15:00"
},
{
"day": 0,
"flight": "AS337",
"utc": "13:03:00"
},
{
"day": 0,
"flight": "AS834",
"utc": "16:09:00"
},
{
"day": 1,
"flight": "AS228",
"utc": "23:53:00"
},
...
...
...
}
What I want to do is index both the “day” and “flight” but “flight” needs to be case insensitive. What I have tried is to create this index:
create index index2 on
travel-sample(distinct array [day, lower(flt.flight)] for flt in schedule END) where type = "route" using gsi;
However, this query does not return anything (e.g., not even the above document):
select * from
travel-sampleuse index (index2 using gsi) where (any flt in schedule satisfies [day, lower(flt.flight)] = [0, "as783"] END) and type = "route";
Also, what if I want to extend this so that the flight can be partially searched? For example, the N1QL would then look similar to:
select * from
travel-sampleuse index (index2 using gsi) where (any flt in schedule satisfies [day, lower(flt.flight)] = [0, "as7%"] END) and type = "route";
It’s like I’m trying to use a “LIKE” but in a situation that doesn’t allow me to?