I don’t have an account for the couchbase Jira, and I wasn’t sure about how to get one, so I thought I would report a bug here.
In the documentation for BITTEST at https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/bitwisefun.html#section_unf_2sv_s1b it states that the all_set is “[OPTIONAL; default is TRUE]”. This is incorrect, the default is in practice FALSE, as shown by the following trivial test.
SELECT ISBITSET(6,[1,2]) AS IsBitSET;
Which returns TRUE, when if the default were TRUE would return FALSE. Supplying the argument explicitly confirms this behaviour.