Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Afaik you cannot do this through the HTTP api, </p> <p>As Christian mentioned you can use a range query, but you don't need a alternative index as you already have the primary key index which can be referenced by <code>$key</code> as index field:</p> <pre><code>olav@nyx ~ (master *%) » curl http://nyx:8098/riak/test/20120931 -d "31. Sep 2012" olav@nyx ~ (master *%) » curl http://nyx:8098/riak/test/20121002 -d "02. Oct 2012" olav@nyx ~ (master *%) » curl http://nyx:8098/riak/test/20121021 -d "21. Oct 2012 olav@nyx ~ (master *%) » curl http://nyx:8098/riak/test/20121102 -d "The future" olav@nyx ~ (master *%) » curl -X POST -H "content-type: application/json" \ -d @- http://localhost:8098/mapred \ &lt;&lt;EOF { "inputs":{ "bucket":"test" , "index":"\$key" , "start":"20121001" , "end":"20121101" } , "query":[{ "reduce":{ "language":"erlang" , "module":"riak_kv_mapreduce" , "function":"reduce_identity" , "keep":true } }] } EOF # ... [["test","20121021"],["test","20121002"]] </code></pre> <p>If you really want key filters with you can use Erlang pb client and do something along these lines (you need <code>riak_kv</code> in your codepath):</p> <pre><code>{ok, Pid} = riakc_pb_socket:start_link("127.0.0.1", 8087), Index = {index, &lt;&lt;"test1"&gt;&gt;, &lt;&lt;"field_int"&gt;&gt;, &lt;&lt;"123"&gt;&gt;}, {ok, Filter} = riak_kv_mapred_filters:build_filter([[&lt;&lt;"ends_with"&gt;&gt;,"1"]]). MapReduce = [ { reduce , {qfun, fun(X, F) -&gt; lists:filter(fun({A, B}) -&gt; F(B) end, X) end} , riak_kv_mapred_filters:compose(Filter) , true}], riakc_pb_socket:mapred(Pid, Index, MapReduce). </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload