Search Examples

These examples of how to search Swarm are demonstrated through curl. 

Queries for Buckets

Tip

For queries within a single bucket, include the bucket in the URL; the filter context=<domain>/<bucketname>does not need to be added.

Query with fields, not involving context
curl -i -X GET  "http://{cluster}?format=json&domain=example.com &fields=name,content-length"
Query with fields, retrieving context as one of the fields
curl -i -X GET  "http://{cluster}?format=json&domain=example.com &fields=name,content-length,context"
Retrieving context as one of the fields and sorting on context
curl -i -X GET  "http://{cluster}?format=json&domain=example.com &fields=name,content-length,context&sort=context:asc" curl -i -X GET  "http://{cluster}?format=json&domain=example.com &fields=name,content-length,contextid,context&sort=context:desc"
List objects >1GB, sorted by size descending
curl -i -X GET "http://{cluster}?format=json&domain=example.com &content-length>=1073741824&sort=content-length:desc,name&fields=name,content-length,context"
Sorting on multiple fields, context, and name, in different orderings
curl -i -X GET  "http://{cluster}?format=json&domain=example.com &fields=name,content-length,context&sort=context:asc,name:asc" curl -i -X GET  "http://{cluster}?format=json&domain=example.com &fields=name,content-length,context&sort=context:desc,name:desc" curl -i -X GET  "http://{cluster}?format=json&domain=example.com &fields=name,content-length,context&sort=name:asc,context:asc" curl -i -X GET  "http://{cluster}?format=json&domain=example.com &fields=name,content-length,context&sort=name:desc,context:desc"
Listing query, retrieving context as one of the fields, sorting on multiple fields with context
 curl -i -X GET  "http://{cluster}/bucket1?format=json&domain=example.com &fields=name,content-length,context&sort=content-length:desc,context:desc"

Queries for Named Objects

Retrieving context as one of the fields
 curl -i -X GET  "http://{cluster}?format=json&domain=example.com &fields=name,content-length,context&stype=NAMED"
Retrieving context as one of the fields and sorting on context
curl -i -X GET  "http://{cluster}?format=json&domain=example.com &fields=name,content-length,context&stype=NAMED&sort=context:asc" curl -i -X GET  "http://{cluster}?format=json&domain=example.com &fields=name,content-length,context&stype=NAMED&sort=context:desc"
Sorting on context and another field in different orderings
curl -i -X GET  "http://{cluster}?format=json&domain=example.com &fields=name,content-length,context&stype=NAMED&sort=context:asc,content-length:asc" curl -i -X GET  "http://{cluster}?format=json&domain=example.com &fields=name,content-length,context&stype=NAMED&sort=context:desc,content-length:desc" curl -i -X GET  "http://{cluster}?format=json&domain=example.com &fields=name,content-length,context&stype=NAMED&sort=content-length:asc,context:asc" curl -i -X GET  "http://{cluster}?format=json&domain=example.com &fields=name,content-length,context&stype=NAMED&sort=content-length:desc,context:desc"
Sorting and inequality context filters
curl -i -X GET  "http://{cluster}?format=json&domain=example.com &fields=name,content-length,context&stype=NAMED&sort=content-length:desc,context:desc &context>=example.com/2015"
Sorting and wildcard context filter
curl -i -X GET  "http://{cluster}?format=json&domain=example.com &fields=name,content-length,context&stype=NAMED&sort=content-length:desc,context:desc &context=example.com/us-*"
Sorting and context marker and multiple markers
curl -i -X GET  "http://{cluster}?format=json&domain=example.com &fields=name,siz,context&stype=NAMED&sort=context:asc &marker=example.com/bucket2" curl -i -X GET  "http://{cluster}?format=json&domain=example.com &fields=name,content-length,context&stype=NAMED&sort=content-length:asc,context:asc &marker=15,example.com/bucket1" curl -i -X GET  "http://{cluster}?format=json&domain=example.com &fields=name,content-length,context&stype=NAMED&sort=context:asc,content-length:asc &marker=example.com/bucket1,15"
With du argument, withreps and withoutreps
curl -i -X GET  "http://{cluster}?format=json&domain=example.com &fields=name,content-length,context&stype=NAMED&sort=content-length:desc,context:desc &du=withoutreps" curl -i -X GET  "http://{cluster}?format=json&domain=example.com &fields=name,content-length,context&stype=NAMED&sort=content-length:desc,context:desc &du=withreps"

Queries for Unnamed Objects

With context sort
curl -i -X GET  "http://{cluster}?format=json&domain=example.com &fields=name,tmborn,context&stype=IMMUTABLE&sort=context:asc

Queries for Named and Unnamed Objects

With context sort
curl -i -X GET  "http://{cluster}?format=json&domain=example.com &fields=name,tmborn,context&stype=IMMUTABLE,NAMED&sort=context:asc &du=withreps"
With context wildcard filter
curl -i -X GET  "http://{cluster}?format=json&domain=example.com &fields=name,tmborn,context&stype=IMMUTABLE,NAMED&sort=context:asc &context=example.com/foo*&du=withoutreps"

Related content

© DataCore Software Corporation. · https://www.datacore.com · All rights reserved.