Long n1ql query time

You can also use the following index.

CREATE INDEX idx_example ON default(from,to,id) WHERE (type = “message”)