Couchbase Identify if a document exist already in the database

I’m doing the next query to figure out if a document exist in the db. If exist I am able to return a true, but if the document don’t exist in the database already.

I’m getting the next issue:

Unable to execute query due to the following n1ql errors:
{“msg”:“No index available on keyspace kids_club that matches your query. Use CREATE INDEX or CREATE PRIMARY INDEX to create an index, or check that your expected index is online.”,“code”:4000}

This is my code, I don’t want to get other fields instead the id, because I only want to identify if the document exist:

/**
* Get the ShipRoom document if exists.
* @return Optional-ShipRoom if exist, Optional.empty() otherwise.
*/
@Query(“SELECT META(sp).id AS _ID, META(sp).cas AS _CAS”
+ " FROM #{n1ql.bucket} as sp"
+ " WHERE #{n1ql.filter}")
Optional findShipRoomDocument();

Any advice?

That means you have document key. You can use SDK API to find out this without using N1QL. Check SDK documentation.
If you need N1QL

SELECT  META(d).id , true AS docpresent 
FROM default AS d USE KEYS ["document key"];