Search Query Arguments
The following table lists all the search query arguments, their values, and usage along with examples:
Argument | Values | Usage | Example |
---|---|---|---|
format |
| RequiredRequests a search query and specifies the desired output format. This query argument is required to trigger a domain/bucket listing query. This format applies to the body portion of the HTTP/1.1 response and does not affect the format of the response headers. All search operations are available with either format. | &format=json &format=xml |
context | string | Filters the search to certain buckets one of these ways:
To restrict search to a bucket, include the bucket in the URL path. Always use with use | &context<=example.com/2015 &context=example.com/foo* |
contextid | UUID | Specifies a search filtered to the context identified by the UUID given. | &contextid=80a4957… |
decorates | UUID | Used in a listing query to find any annotation objects that may exist for a given ETag (or earlier query result “hash”). See Metadata Annotation and Listing Operations. | &decorates=a95780a4… |
domain | domain-name | In a normal SCSP storage request, the required Host header is the assumed domain (or context) for the operation. Most HTTP/1.1 clients and browsers use the host portion of the URL as the value for the Host header in the Swarm request. Supply the domain argument to explicitly override it if the value of the Host request header does not match the domain name. A domain argument always has precedence over the Host header in the HTTP/1.1 request. Set the value equal to nothing (empty string) to find unnamed objects not tenanted in any domain. | &domain=example.com &domain= |
domains | none (ignored) | Used for listing the domains within a cluster. No value is used with this argument. | &domains |
du |
| Dynamically queries the disk usage for a domain or bucket context. With du, use the
See Storage in Use for how to query the storage in use for domains and buckets. | &du=withreps&size=0 |
field‑name | any indexed metadata field, such as:
| Filters results to those matching the operations on one or more specified fields. Multiple filters are joined by a logical AND; to specify OR, add the &or argument. Supports standard comparison operators on specific fields to filter the results returned:
This is an overloading of normal query argument processing. | &x-width-meta<=800 &x-height-meta<=600 &content-type=image/bmp&or &content-type=image/png &content-length>=1073741824 |
fields | Comma-separated list of field names, or | Replaces the default fields and specifies, as a comma-separated list, which fields to display in the output (See Metadata Field Matching). Use | &fields=name,content-length &fields=all |
index |
| On a write (POST, PUT, COPY, APPEND, DELETE) request, forces immediate search indexing of the newly written/deleted object. Appears on Gateway requests when enabling the Gateway Configuration option | &index=yes |
sync |
| On a read (listing query GET) request, forces consistency of results returned on the listing.
Appears on Gateway requests when enabling the Gateway Configuration option | &sync=now |
marker | empty value or a comma-separated list of sorted column key values | Provides a mechanism to use multiple requests to receive a complete result set. Defaults to Used with the | &marker=&sort=tmBorn&size=50 |
or |
| Joins them with a logical OR (default is AND) when used with multiple field comparisons. Defaults to false. | &or |
prefix | string | Matches the string to the start (prefix) of the object's name or UUID. The names of the objects in the output list share the same prefix string.
To find untenanted unnamed objects, include " | &prefix=Q1 &stype=unnamed&prefix=93f &stype=unnamed&prefix=93f&domain= |
size | integer | Constrains the number of results to be returned by the query. Defaults to 1000. This argument is equivalent in purpose to the "limit" or "max-keys" arguments in other cloud protocols. The maximum is 50000 but we do not recommend using more than 10000. ImportantThis is the size of the result set, not the object size. To work with object size, use the field TipSet size to | &size=5000 |
sort | Comma-separated list of field names, with optional modifier | Sets the sort order of one or more fields, with the first field sorting first. Sorting direction defaults to ascending ( | &sort=size:desc,name |
stype | Comma-separated list of Swarm types | Specifies the type of objects being requested in a search. Defaults to Valid values: | &stype=unnamed |
versioned |
| Allows filtering updateable (named and alias) objects by versioning status, checking whether versioning was enabled in the context at the time they are written. Checks the value of the Castor‑System‑IsVersioned header. (v10.0) | &versioned=true |
versions versions&name versions&prefix |
name of object first part of name |
Requests a listing of all versions of the named object. Requests a listing of all versions of all objects matching the prefix. See Object Versioning. | &versions &versions&name=logo.jpg &versions&prefix=2019Q1/ |
deletemarker |
| Requests a listing of deletemarker objects. | &deletemarker=true |
Marker Argument
The marker
argument provides a mechanism to retrieve a single result set using multiple HTTP requests. This is useful when a large result set is impractical to receive using one HTTP request. All marker operations work using a sorted result set. The system implicitly uses sort=name
if a sort
argument is not provided. The size
argument is used to control how many items are returned per HTTP request.
On the first request, marker=
(without a value) is used to indicate a request at the beginning of the result set. For subsequent requests, the last value(s) from the sort field(s) is used to indicate the last record received from the previous request.
Marker Example
Consider the following set of object names in the bucket dictionary
.
applaud
appoints
arches
basically
boardwalk
buffers
carpet
defender
Receive the first four items in the result set:
GET /dictionary?format=json&domain=example.com&size=4&fields=name&marker=
[
{ "name": "applaud" },
{ "name": "appoints" },
{ "name": "arches" },
{ "name": "basically" }
]
The last sort field value from the first request is basically
, so the next request to continue receiving the result set is as follows:
GET /dictionary?format=json&domain=example.com&size=4&fields=name&marker=basically
[
{ "name": "boardwalk" },
{ "name": "buffers" },
{ "name": "carpet" },
{ "name": "defender" }
]
Since the result set is now exhausted, a subsequent request yields:
Sort vs Marker Relationship
The marker
value is either the last value or values from the sort fields. The marker also contains the last field values in it if using: sort={field1},{field2},...,{fieldN}
Both ascending and descending sort orders are supported for each of the so