@RiakIndex annotated field is not stored as part of value

Christopher Meiklejohn cmeiklejohn at basho.com
Mon Jan 26 09:16:15 EST 2015

> On Jan 26, 2015, at 09:45, Santi Kumar <santi at veradocs.com> wrote:
> Hi 
> I'm defining a field of an object as 2i index with @RiakIndex. While creating the object I initialised both the values and stored the object against the key of that object and stored against the index.
> In a separate thread another field of the object is updated where I dont have handle to the 2i field. So I simply updated the field and stored back. As the 2i indexed field is not part of the object, that is gone as null and 2i index is removed from that object.
> After this, any search method on the original index key is failing to return this object. Is there any way to access 2i index corresponding to the key of object or storing the 2i index field as part of the object.
> When I fetch the object with the key, I'm not able to see the filed which is definied as 2i field?
> Please give me some clues on that.

Hi Santi,

When writing tags on objects for use with the 2i mechanism, it's required that you write all tags for the object each write; most client libraries will handle this if you perform a read-modify-write.  Does this help clarify?


More information about the riak-users mailing list