Table of Contents | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
Search operations are an extremely powerful feature for locating content; they work on the metadata of the objects within the storage cluster. Searches use metadata matching constraints provided in the client request and return a list of objects that match those constraints.
Searches can take place across all objects within the domain or searches can be constrained to the context of a particular bucket. When full metadata search is enabled, you can use any custom metadata field value as a search constraint.
Infotip |
---|
BestpracticePracticeDo not apply a context filter redundantly in cases where Swarm filters by default, such as when searching for named objects in a bucket, buckets in a domain, or unnamed objects in a domain. |
Performance Impact
Consider performance when designing searches spanning entire domains. context
(domain and bucket) names are looked up from the contextid
, so these domain-wide searches incur an additional performance penalty:
...
Info |
---|
TipCheck the performance impact when sorting and filtering across an entire domain. |
Search Examples
Unless otherwise noted all matching operations are string-based comparisons:
...
Code Block | ||
---|---|---|
| ||
GET /myBucket?format=json&domain=myDomain &fields=name,content-length |
Enabling
...
Case-
...
Insensitive Search (name.lower)
You control case-sensitivity in your Elasticsearch queries by using the correct form of the name field:
...
The Swarm search setting, search.caseInsensitive, is specific to SCSP queries, versus querying ES directly. When this is enabled, case-insensitive SCSP search queries are performed by default. (v9.0)
Swarm Setting | Effect |
---|---|
| All name-based searches use the name.lower field, so SCSP named searches are always case-insensitive. |
| All name-based searches use the name field, and is case-sensitive. |
Info |
---|
ImportantCustom metadata values are always indexed to be only case-sensitive or case-insensitive, depending on the value of |
Using
...
Content-
...
Length
The content-length field for objects is recognized as a numeric field and supports equality, less-than-equal-to, and greater-than-equal-to matching operators.
Info |
---|
TipUse ">=" or "=>" and "<=" or "=<". |
Using content-length
Code Block | ||
---|---|---|
| ||
GET /?format=json&domain=myDomain&content-length=1024 GET /?format=json&domain=myDomain&content-length<=1024 GET /?format=json&domain=myDomain&content-length>=1024 |
...