How to use a secondary index on a Riak map

210 views Asked by At

Is there a way to use the Java client to create a secondary index on values that are maps in Riak? The code I have for creating the map is as follows

        RegisterUpdate value = new RegisterUpdate(rawValue);
        MapUpdate data = new MapUpdate().update("key", value);
        UpdateMap request = new UpdateMap.Builder(location, data)
                .withReturnDatatype(true).build();
        client.execute(request);

The documentation only shows how to do it with RiakObject types, which have a getIndexes method where you can get a specif index and add/remove values from it. I haven't found anything for any of the CRDT types.

1

There are 1 answers

0
Craig On BEST ANSWER

Unfortunately secondary indexes are not supported for the Riak Data Types (map, flag, counter, set, register). Instead of 2i you will want to look at Riak Search 2.0: http://docs.basho.com/riak/latest/dev/search/search-data-types/