How to stop couchbase to keep searching n1ql query


I want to stop couchbase for searching too long if its not be able to find the record lets say in 5 sec max . Right now sometimes application got hanged because couchbase is searching in background (I guess) . Is there any way to stop this behavior.

i tired this but its not stop it in 1 sec


set timeout