Nickel
Nickel

Reputation: 533

Using Secondary Indices as input to a map reduce function in Riak

Does anyone know what form the 'input' item will take in a map reduce that uses the HTTP API in Riak when using the output of a secondary index query? The Riak website states 'If you've enabled Secondary Indexes, the list of inputs can also reference a Secondary Index query' but then never explains what form that would take.

Since the input format for most map reduce queries is "input" : ["bucket", "key", "keydata"] what is the equivalent of 'curl riakhost:port/buckets/bucketname/index/indexname_bin/indexvalue'?

A link or some information would be useful.

Upvotes: 1

Views: 624

Answers (1)

Brian Roach
Brian Roach

Reputation: 76908

"inputs":{"index":"INDEX_NAME_bin","bucket":"BUCKET","key":"INDEX_VALUE"}

The "examples" section for Secondary Indexes shows how to use an exact match as well as a range query as inputs for mapreduce:

http://docs.basho.com/riak/1.2.1/tutorials/Secondary-Indexes---Examples/#Exact-Match-Query

http://docs.basho.com/riak/1.2.1/tutorials/Secondary-Indexes---Examples/#Range-Query

Upvotes: 4

Related Questions