SELECT raw visitId FROM bucket WHERE type = "EVENT"
AND (configurableMetadataId="XXX" OR ev.eventTypeId = "XXX)
And I would like to create a GSI but I’m stuck with the OR keyword.
I tried to create 2 separated indexes:
CREATE INDEX idx_et ON bucket(eventTypeId) WHERE type = "EVENT" CREATE INDEX idx_cm ON bucket(configurableMetadataId) WHERE type = "EVENT"
And I also tried a composite index: CREATE INDEX idx_et_cm ON bucket(eventTypeId, configurableMetadataId) WHERE type = "EVENT"
But none of these options are working. The composite index would work if it was an AND instead of an OR but then how do I create an index working with an OR condition?
SELECT raw visitId FROM bucket WHERE type = "EVENT"
AND configurableMetadataId="XXX"
UNION
SELECT raw visitId FROM bucket WHERE type = "EVENT"
ev.eventTypeId = "XXX";
4.6.4
SELECT raw visitId FROM bucket WHERE type = "EVENT"
AND (configurableMetadataId="XXX" OR ev.eventTypeId = "XXX)
4.6.3
SELECT raw visitId FROM bucket WHERE (type = "EVENT"
AND configurableMetadataId="XXX") OR (type = "EVENT" AND ev.eventTypeId = "XXX);
CREATE INDEX ix1 ON bucket(field.roleId) WHERE type = "instance";
CREATE INDEX ix2 ON bucket(queue) WHERE type = "instance";
OR
CREATE INDEX ix1 ON bucket(type, field.roleId, queue) WHERE type = "instance";
If you think you have field.roleId in all documents or want queue matched want documents that have filed.roleId has value only try the following query.
SELECT * FROM bucket WHERE type = ‘instance’ and field.roleId IS NOT MISSING AND (field.roleId ==‘102419231’ or queue in [2,1,52]) limit 100;