Skip to content

Instantly share code, notes, and snippets.

@clr
Created November 6, 2012 05:34
Show Gist options
  • Save clr/4022791 to your computer and use it in GitHub Desktop.
Save clr/4022791 to your computer and use it in GitHub Desktop.
Basic Querying Examples
curl -X PUT http://127.0.0.1:8091/buckets/qcon/keys/nosql4evah \
-H 'content-type: text/plain' \
-d $'Scale out all the things!\n'
curl -X GET http://127.0.0.1:8091/buckets/qcon/keys/nosql4evah
curl -X DELETE http://127.0.0.1:8091/buckets/qcon/keys/nosql4evah
curl -X GET http://127.0.0.1:8091/buckets/qcon/keys/nosql4evah
curl -X PUT http://localhost:8091/buckets/qcon_mr/keys/foo -H 'Content-Type: text/plain' -d 'pizza data goes here'
curl -X PUT http://localhost:8091/buckets/qcon_mr/keys/bar -H 'Content-Type: text/plain' -d 'pizza pizza pizza pizza'
curl -X PUT http://localhost:8091/buckets/qcon_mr/keys/baz -H 'Content-Type: text/plain' -d 'nothing to see here'
curl -X PUT http://localhost:8091/buckets/qcon_mr/keys/bam -H 'Content-Type: text/plain' -d 'pizza pizza pizza'
curl -X POST http://localhost:8091/mapred -H 'Content-Type: application/json' -d '{
"inputs":"qcon_mr",
"query":[{"map":{"language":"javascript",
"source":"function(riakObject) {
var m = riakObject.values[0].data.match(/pizza/g);
return [[riakObject.key, (m ? m.length : 0 )]];
}"}}]}'
# don't forget to open app.config and switch storage_backend to riak_kv_eleveldb_backend
curl -X PUT http://localhost:8091/buckets/qcon_2i/keys/apple \
-H 'x-riak-index-category_bin: fruit' \
-H 'Content-Type: text/plain' \
-d 'malus domestica'
curl -X PUT http://localhost:8091/buckets/qcon_2i/keys/banana \
-H 'x-riak-index-category_bin: fruit' \
-H 'Content-Type: text/plain' \
-d 'musa acuminata'
curl -X PUT http://localhost:8091/buckets/qcon_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://localhost:8091/buckets/qcon_2i/keys/potato \
-H 'x-riak-index-category_bin: vegetable' \
-H 'Content-Type: text/plain' \
-d 'solanum tuberosum'
curl http://localhost:8091/buckets/qcon_2i/index/category_bin/fruit
curl http://localhost:8091/buckets/qcon_2i/index/category_bin/vegetable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment