I have the following index-
CREATE INDEX `ix_events_active` ON `default`(`id`,`end_date`,`created_by`,`created_at`,`alert_id`,`name`,`child_counter`,`start_date`,
`zone_record`,`send_active`,`duration_type`,`creator_name`)
WHERE (((((`recipient_type` in [0, 3, 4])
and (`active_type` = 0))
and (`active_type` is not missing))
and (`parent_id` is missing))
and ((meta().`id`) like "event::%"))
And I am using the following query-
SELECT e.id, e.active_type, e.end_date, e.created_by, e.recipient_type, e.created_at, e.alert_id, e.name,
e.child_counter, e.start_date, e.zone_id_record, e.send_active, e.duration_type, e.creator_name AS user_name
FROM default e
WHERE e.active_type = 0
AND DATE_DIFF_STR(e.end_date, '2019-07-08T20:03:13', 'second') >= 0
AND e.created_by IN ['b37ddca31eae49085c96141ca6767ebd']
AND e.recipient_type IN [0, 3, 4]
AND META(e).id LIKE 'event::%'
AND e.parent_id IS MISSING
AND e.active_type IS NOT MISSING
AND e.id IS NOT MISSING
ORDER BY e.name asc
LIMIT 10 OFFSET 0;
When I use the explain I can see that it is using intersect scan (ix_events_active and primary). Also the query is significantly slow(around 2 seconds). Even explicitly using the USE INDEX syntax doesnât work, just slightly lesser time (1.3 seconds). I have tried different predicates in indexing and n1ql sections, but none seems to be working. Any solution please?