Simple mapreduce with 2i returns different result

Mattias Sjölinder mattias at
Wed Apr 17 03:54:36 EDT 2013

Thanks for your help. Your query returned the same number over and over
again just as expected.

I think I have found the reason for my problem though. The client lib
CorrugatedIron seems to wrap each document in the MapReduce result into a
array turning the result into a nested array looking like:
[[{doc1}], [{doc2}], [{doc3}]] counting 3 arrays & 3 docs
and sometimes
[[{doc1}], [{doc2}, {doc3}]] counting 2 arrays and 2 docs (according to my
client code... :)

Why the result for same query in CorrugatedIron and for a simple curl
differs I don't know but I will investigate it further.

Thanks again for your help!

Best regards,

2013/4/16 Christian Dahlqvist <christian at>

> Hi Mattias,
> The following curl query simply counts the number of inputs, and has
> worked well for me in the past. Can you please run it against the cluster a
> couple of times and see if it also return varying number of results?
> curl -XPOST http://localhost:8098/mapred
>   -H 'Content-Type: application/json'
>   -d '{"inputs":{
>            "bucket":"som-bucket",
>            "index":"userid_bin",
>            "key":"18481123123"
>        },
>        "query":[{"reduce":{"language":"erlang",
>                            "module":"riak_kv_mapreduce",
>                            "function":"reduce_count_inputs"
>                            }}]}'
> Best regards,
> Christian
> On 16 Apr 2013, at 15:52, Mattias Sjölinder <mattias at> wrote:
> 18481123123
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the riak-users mailing list