Riak secondary indexing 'Unknown field type for field' error

Hrishikesh More hrishikesh.r.more at gmail.com
Tue Oct 23 16:42:39 EDT 2012


Hi,

    Using following JSON I am trying to create secondary indexes in Riak.

    {
            “Id” :  “xxxx”,
            “login”   : “xxx”,
            “context” : “xxx”,
            “creationDate” : “xxxx”,
             ...........
             ...........
            “sku1” : {
                         quantity : 1,
                       },
            “sku2” : {
                         quantity : 2,
                       },
    }

   I prepare RiakIndexes by using above JSON and looping over it. When I
try to store (the same json string) it in following way I get 'Unknown
field type for field: 'sku1'  error.

   IRiakObject riakObj = RiakObjectBuilder.newBuilder(bucketName, id)
                .withIndexes(indexes)
                .withValue(json)
                .withContentType('application/json')
                .build();

   IRiakObject returnObject = bucket.store(riakObj);

Error:
    com.basho.riak.client.http.response.RiakResponseRuntimeException:
Unknown field type for field: 'sku1'.
Unknown field type for field: 'sku2'.

1.  If I don't define nested JSON it works, however it I put 'skuid'  using
objectMapper.createObjectNode()  and add to parent object node (while
preparing JSON for testing), it gives above error.
     Do I have to write custom serializer here?
2.  Is there a way to ignore this error through config in Riak?

thanx.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20121024/e6b2e789/attachment.html>


More information about the riak-users mailing list