Product tutorials, how-tos, and fully-documented APIs.

HTTP Secondary Indexes

    Secondary Indexes allows an application to tag a Riak object with one or more field/value pairs. The object is indexed under these field/value pairs, and the application can later query the index to retrieve a list of matching keys.

    Request

    Exact Match:

    GET /buckets/mybucket/index/myindex_bin/value
    

    Or Range Query: GET /buckets/mybucket/index/myindex_bin/start/end

    Response

    Normal status codes:

    Typical error codes:

    Example

    $ curl -v http://localhost:8098/buckets/mybucket/index/field1_bin/val1
    * About to connect() to localhost port 8098 (#0)
    *   Trying 127.0.0.1... connected
    * Connected to localhost (127.0.0.1) port 8098 (#0)
    > GET /buckets/mybucket/index/field1_bin/val1 HTTP/1.1
    > User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8r zlib/1.2.3
    > Host: localhost:8098
    > Accept: */*
    >
    < HTTP/1.1 200 OK
    < Vary: Accept-Encoding
    < Server: MochiWeb/1.1 WebMachine/1.9.0 (participate in the frantic)
    < Date: Fri, 30 Sep 2011 15:24:35 GMT
    < Content-Type: application/json
    < Content-Length: 19
    <
    * Connection #0 to host localhost left intact
    * Closing connection #0
    {"keys":["mykey1"]}%