Need to create a view to delete a document

Hi Guys,

can any one help me out how to create view for my bucket to delete a document in bucket based on accountNumber, here accountNumer is one of the key in document it is not id.

You can use GSI index.
CREATE INDEX ix1 ON bucket(accountNumer);
DELETE FROM bucket WHERE accountNumer = 12345;

I need to create view or I need a n1ql query so I can perform operation from my java code
some query like this

@Query("SELECT META(`Customer`).id AS _ID, META(`Customer`).cas AS _CAS, Customer.accountNumber as accountNumber FROM #{#n1ql.bucket} WHERE #{#n1ql.filter} AND customerId=$1")

CREATE INDEX ix1 ON Coustmer(customerId);