Solution On Index


Is it better to give a choice to couchbase engine to select the index or we need to define proper index in the code and restrict it?



You can use USE INDEX (“index you like”) in your N1QL statement


N1QL uses rule based optimization and try to pick the best index based on rules. You can also USE INDEX option provide the hint.