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.* FROMappconnectWHERE (appId= "whitelabel" AND geofenceBased = false ANDdeleted= FALSE) AND_class= "com.commencis.appconnect.push.data.entity.PushEntity" ORDER BYcreatedAtDESC LIMIT 25 OFFSET 0
2-)
SELECT META(app).id AS _ID, META(app).cas AS _CAS,app.* FROMappWHERE (appId= "whitelabel" AND geofenceBased = false and status = "DRAFT" ANDdeleted= FALSE) AND_class= "com.test.push.data.entity.PushEntity" ORDER BYcreatedAtDESC LIMIT 25 OFFSET 0
3-)
SELECT META(app).id AS _ID, META(app).cas AS _CAS,app.* FROMappWHERE (appId= "whitelabel" AND status = "DRAFT" ANDdeleted= FALSE) AND_class= "com.test.push.data.entity.PushEntity" ORDER BYcreatedAtDESC 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