Query Keys with startkey and endkey without n1ql

I am using Couchbase CE 4.5 and the latest version of the sdk.
In the webconsole on the documents page i can search by a range of keys.

I can’t find this on the sdk. I tried search here in the forum , but i only find option to use n1ql by creating an index on Meta.Id.
But as we can see in the image, i have no index and i can query by key with range.
How can i do that from the sdk?

That is generating a get request

it gives the possibility of include the documentos or only the key.


Hi @rafael.felix,

I’ve looked at the documentation, and I don’t see that endpoint documented. So my guess is that it is a non-supported endpoint, exposed only for the UI and not meant for applications to use. Instead, you could create a View or use a N1QL query with an index as you’ve suggested.

Indeed this is not a documented or supported API. It works well enough for the document editor, but it can be quite slow in certain cases. A primary index with N1QL is likely to be faster, though with the resource costs inherent in primary indexes. If the undocumented API works for your use case, great! Just remember that it is not supported, and may get deprecated at some point in the future.

1 Like