SELECT RAW owner FROM sync_gateway
as owners WHERE type=“userprofile_private” and emailConfirmed=true and lastSignInDate <= “2018-10-05T00:00:00Z”
If this is small number
do 2 queries and pass the subquery output as query parameter and run the parent query has adhoc=true
Otherwise it needs to scan whole index.