I think the simplest would be to execute ‘EXPLAIN’ for your query : Successful Request | Couchbase Docs
curl -v -u Administrator:password 'http://localhost:8093/query/service?statement=EXPLAIN%20SELECT%20*%20FROM%20my_bucket'
This post has suggestion : AST Generator for N1QL - #7 by eben