We are using the Couchbase 4.5 Server Edition. Whenever we fire a SELECT
query on the bucket, we get the following JSON as output
{ "results": [], "metrics": { "elapsedTime": "929.786µs", "executionTime": "886.295µs", "resultCount": 0, "resultSize": 0 } }
Is this a bug with Couchbase? Any pointers will be helpful.
thanks,
Neelesh
Hey Neelesh,
It looks like your query is returning correctly, just that no documents matched it. Are you able to share the query you’re running? Do you get results from a simple query like SELECT * FROM my_bucket;
?
Hi JFlat,
No, I am not getting any results out of the simple SELECT
query as well. Also, I tried fetching records with a specific attribute value that exists in some documents in the bucket. Even those results are not returned.
thanks,
Neelesh
Huh, that does sound strange. Sorry for the simple questions, but could you check a few things:
- There are definitely documents in the bucket.
- It is definitely the same bucket you are querying.
- What happens if you do a
USE KEYS
query for one of the documents in the bucket, e.g.:
SELECT * FROM my_bucket USE KEYS "my_document_key";
- What’s the status code that’s shown at the top of the results, e.g.:
- What output/results do you get if you use cbq?
If you can get screenshots of any of this (as much as possible), that’d be a big help!
Hi JFlat,
I could get the result by using the USE KEYS
clause. However, without the said clause, I am not able to retrieve the results. Can you suggest some examples with USE KEYS
that can be used for querying multiple documents ?
thanks,
Neelesh
@neeleshkumar_mannur what kind of indexes do you have created on your bucket?
@daschl, I have created PRIMARY INDEXES
on the buckets.
@neeleshkumar_mannur can you show us the query you run as well as the output with an EXPLAIN before?
@daschl
PFB the output of the query EXPLAIN SELECT * FROM ``raw_data`` USE KEYS "1";
[
{
“plan”: {
“#operator”: “Sequence”,
“~children”: [
{
“#operator”: “KeyScan”,
“keys”: “"1"”
},
{
“#operator”: “Parallel”,
“maxParallelism”: 1,
“~child”: {
“#operator”: “Sequence”,
“~children”: [
{
“#operator”: “Fetch”,
“keyspace”: “raw_data”,
“namespace”: “default”
},
{
“#operator”: “InitialProject”,
“result_terms”: [
{
“expr”: “self”,
“star”: true
}
]
},
{
“#operator”: “FinalProject”
}
]
}
}
]
},
“text”: “SELECT * FROM raw_data
USE KEYS "1";”
}
]
Please ignore no space in the above query.
thanks,
Neelesh
This same issue has been happening to me as well since I upgraded to 4.5.0 instead of the 4.5.0 developer preview.
I have records in my bucket, but I cannot query them at all using n1ql.
Hey codestar - Have you already done the troubleshooting steps above, that is you created a primary index and verified that you can query using primary keys? I’m assuming that you have already verified that the index and query services are both running.
If that doesn’t work, please create a new thread and describe what you’re specifically trying to do and what happens.
Best,
-Will
Any update guys…? I am still not able to query the datasets…