N1QL query to get documents not having meta().id as _sync

I woulk to use sg_allDocs_1 index to get all documents which are not having _sync in meta().id which has already where condition as below
(not ((meta().id) like “\_sync:%”))

But when i query below, i am getting error as index not found
select count(*) from db where (not ((meta().id) like “\_sync:%”))

Query Response:
“msg”: “No index available on keyspace ptxdata that matches your query. Use CREATE INDEX or CREATE PRIMARY INDEX to create an index, or check that your expected index is online.”,

Could you give us the actual statement that creates the index?

@johan_larson Assuming that’s the index I think it is ( :wink: ), it’s one of Sync Gateway’s internal ones, so would be:

CREATE INDEX `sg_allDocs_1` ON `test`(((self.`_sync`).`sequence`),((self.`_sync`).`rev`),((self.`_sync`).`flags`),((self.`_sync`).`deleted`)) WHERE (not ((meta().`id`) like "\\_sync:%")) WITH { "defer_build":true }