0

I'm just testing out riak. I've set the backend to memory, given it 2GB max and enabled search.

I'm using nodejs and simpleriak. I've inserted 100 test objects with the following code:

for ( var i = 0; i < 100; i++ ) {
    //add
    riak.put({
        bucket: 'testy',
        key: String(i),
        index: { a_bin: 'A' + i },
        index: { b_bin: 'B' + i },
        data: {
            A: "A" + i,
            B: "B" + i,
            C: "C" + i
        }
    }, function (err, reply) {
        console.log(err, reply);
    });
};

I can now successfully get my objects by key from the command line using:

$ curl -v http://localhost:8098/buckets/testy/keys/1

However, I cannot retrieve objects with my 2i:

$ curl -v http://localhost:8098/buckets/testy/index/a_bin/A1

returns

{"keys":[]}

Thoughts? Thanks!

Community
  • 1
  • 1
Adam
  • 3,142
  • 4
  • 29
  • 48
  • I don't think JSON permits duplicate key names in an object, so `index: { a_bin: 'A' + i },index: { b_bin: 'B' + i },` isn't valid, and might be interpreted as the second value for `index` superseding the first. – Joe Mar 15 '15 at 00:24
  • That makes sense, but the documentation specifically states: "You can specify as many indexes as you like, the property name will be the index and its value the key." – Adam Mar 20 '15 at 15:42
  • Did you try adding them as separate properties of a single index object instead of conflicting index objects? – Joe Mar 20 '15 at 16:11

1 Answers1

0

For anyone who comes across this, it appears that there's a problem with the simpleriak driver. I just added an object via the http api from the command line and then successfully called it with the index.

Adam
  • 3,142
  • 4
  • 29
  • 48