Skip to content

Instantly share code, notes, and snippets.

@clr
Created February 8, 2013 15:06
Show Gist options
  • Save clr/4739554 to your computer and use it in GitHub Desktop.
Save clr/4739554 to your computer and use it in GitHub Desktop.
curl -X PUT http://127.0.0.1:8091/buckets/statefarm_2i/keys/apple \
-H 'x-riak-index-category_bin: fruit' \
-H 'Content-Type: text/plain' \
-d 'malus domestica'
curl -X PUT http://127.0.0.1:8091/buckets/statefarm_2i/keys/banana \
-H 'x-riak-index-category_bin: fruit' \
-H 'Content-Type: text/plain' \
-d 'musa acuminata'
curl -X PUT http://127.0.0.1:8091/buckets/statefarm_2i/keys/tomato \
-H 'x-riak-index-category_bin: fruit' \
-H 'x-riak-index-category_bin: vegetable' \
-H 'Content-Type: text/plain' \
-d 'solanum lycopersicum'
curl -X PUT http://127.0.0.1:8091/buckets/statefarm_2i/keys/potato \
-H 'x-riak-index-category_bin: vegetable' \
-H 'Content-Type: text/plain' \
-d 'solanum tuberosum'
curl http://127.0.0.1:8091/buckets/statefarm_2i/index/category_bin/fruit
curl http://127.0.0.1:8091/buckets/statefarm_2i/index/category_bin/vegetable
curl -X PUT http://127.0.0.1:8091/buckets/statefarm_mr/keys/foo \
-H 'Content-Type: text/plain' \
-d 'pizza data goes here'
curl -X PUT http://127.0.0.1:8091/buckets/statefarm_mr/keys/bar \
-H 'Content-Type: text/plain' \
-d 'pizza pizza pizza pizza'
curl -X PUT http://127.0.0.1:8091/buckets/statefarm_mr/keys/baz \
-H 'Content-Type: text/plain' \
-d 'nothing to see here'
curl -X PUT http://127.0.0.1:8091/buckets/statefarm_mr/keys/bam \
-H 'Content-Type: text/plain' \
-d 'pizza pizza pizza'
curl -X POST http://127.0.0.1:8091/mapred \
-H 'Content-Type: application/json' \
-d '{
"inputs":"statefarm_mr",
"query":[{"map":{"language":"javascript",
"source":"function(riakObject) {
var m = riakObject.values[0].data.match(/pizza/g);
return [[riakObject.key, (m ? m.length : 0 )]];
}"}}]}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment