Riak secondary indexing 'Unknown field type for field' error

Brian Roach roach at basho.com
Tue Oct 23 16:58:31 EDT 2012


How, exactly, are you creating 'indexes' ?

A secondary index in Riak has to be an integer or a string.

Thanks,
Brian Roach

On Tue, Oct 23, 2012 at 2:42 PM, Hrishikesh More
<hrishikesh.r.more at gmail.com> wrote:
> 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.
>
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>




More information about the riak-users mailing list