CouchBase Range Search

I am considering using CouchBase for a very strong and heavy application. I will also need to support a search based on various document attributes as well as range queries.

CouchBase has submissions that allow you to search outside of searches for key values, but it looks like it's mainly for getting documents in a certain range, for example. get all documents indexed between the two specified keys, instead of "providing me with all documents that have the genre attribute for" adventure "or" giving me all documents that have a creation date between 1/1/1 and 2/1 /1 "

Is there a way to achieve what I want without an external index?

+5
source share
1 answer

You can definitely do what you described there. You would do both with views in Couchbase Server 2.0.

For example, a general method when looking for a date range is to emit a JSON array from your display function in the view. This will give you something like: [2012, 5, 11, 16, 27, 41]

Since when you request a view, the JSON array is a valid place for the key to start and end the key, you can specify this range.

Similarly, retrieving all the attributes that you selected each of them from the map function using doc _id. Then, using one of the Couchbase SDKs , you can set the include docs option when prompted, and the document will be automatically extracted.

+3
source

All Articles