How to write a correct view and query for my data?

I’m a beginner.

My data is like the following.
{
“id”:“fc5d2f9b-cdcd-49a3-bfab-cf0fb4a4970c”,
“creationDate”:“2016-07-19T12:00:24-0700”,
“isVerifyPurchase”:false,
“siteId”:0,
“review_count”:0,
“isRatingonly”:false,
“expireDate”:“2016-07-24T04:53:56-0700”,
“itemId”:“110008817025”,
“used”:false,
“autoTagProductId”:“1510586753”
}

My requirement is I can filter by expireDate, review_count and siteId.

So far, I create view like the following.

function (doc, meta)
{ emit([doc.expireDate,doc.review_count,doc.siteId], null); }

I try to use
ViewResult result = bucket.query(ViewQuery.from(designDocName, viewname).startKey(JsonArray.from(date, reviewcount, siteId)));

To search, the result will return all the data which only filter by expireDate.

Thanks

If you are using Couchbase 4+, you can also use N1QL. If you are familiar with SQL, it might be easier.

My sample couchbase is 4+. but N1QL not work.

Nothing return, even the following simple query.

Cluster cluster = CouchbaseCluster.create();
//
Bucket bucket = cluster.openBucket(“beer-sample”);

N1qlQueryResult queryResult = bucket.query(N1qlQuery.simple(“SELECT * FROM beer-sample”));

cluster.disconnect();

BTW:
My real couchbase is 3+. Not sure if it support N1QL.

N1QL requires 4+. You should test your query using cbq shell. If that works, then you will be able to issue the query programmatically.