Hi everyone, I have a question and kind a stuck with it. I want to use 3 query type as below.
1-)
SELECT META(
appconnect).id AS _ID, META(
appconnect).cas AS _CAS,
appconnect.* FROM
appconnectWHERE (
appId= "whitelabel" AND geofenceBased = false AND
deleted= FALSE) AND
_class= "com.commencis.appconnect.push.data.entity.PushEntity" ORDER BY
createdAtDESC LIMIT 25 OFFSET 0
2-)
SELECT META(
app).id AS _ID, META(
app).cas AS _CAS,
app.* FROM
appWHERE (
appId= "whitelabel" AND geofenceBased = false and status = "DRAFT" AND
deleted= FALSE) AND
_class= "com.test.push.data.entity.PushEntity" ORDER BY
createdAtDESC LIMIT 25 OFFSET 0
3-)
SELECT META(
app).id AS _ID, META(
app).cas AS _CAS,
app.* FROM
appWHERE (
appId= "whitelabel" AND status = "DRAFT" AND
deleted= FALSE) AND
_class= "com.test.push.data.entity.PushEntity" ORDER BY
createdAtDESC LIMIT 25 OFFSET 0
In summary, geofenceBased and status is changing - All together, only geofenceBased, only status.
Can I handle all quries in one index and my index is:
create index myIndex on app(appId, geofenceBased, status, createdAt DESC)
WHERE deleted = FALSE AND _class = “com.push.data.entity.PushEntity”;
If I use like this; If I query with only geofenceBased or and status it uses OrderedIntersectScan, but if I query geofence and status together it uses my index.
How can I create index for my problem but the using minimum index ? If you don’t mind, I want to ask what is OrderedIntersectScan. I am new at couchbase. Any idea please