Object Metadata Querying
Tigris indexes important metadata fields such as Content-Type
,
Content-Length
, and Last-Modified
for every object stored in a bucket. You
can query these objects using a SQL-like syntax through the X-Tigris-Query
header when using the
ListObjectsV2 API.
The X-Tigris-Query
field query can be thought of as the WHERE
clause in a
SQL query. For instance, to find all objects with a Content-Type
of
text/javascript
, set the header as follows:
X-Tigris-Query
:`Content-Type` = "text/javascript"
Queryable Fields
Tigris supports querying against the following fields:
`Content-Type`
: The content type assigned during upload.`Content-Length`
: The size of the object.`Last-Modified`
: The date and time the object was last modified in RFC3339 format.
SQL Operations
Query supports following comparison operators:
=
: Equal!=
: Not Equal>
and<
: Greater than and less than>=
and<=
: Greater than or equal and less than or equalAND
: Combine multiple conditions in a query.
Order by
You can sort the list using ORDER BY
. For example, to retrieve all items
smaller than 64KB
ordered by Content-Type
:
`Content-Length` < 65536 ORDER BY `Content-Type`
Example Queries
Example queries that can be performed:
`Content-Type` = "text/plain"
`Content-Type` >= "text/c" AND `Content-Type` < "text/j"
`Content-Length` > 0 ORDER BY `Content-Length` ASC
`Content-Length` != 65536 AND `Content-Type` = "text/plain"
`Last-Modified` > "2024-06-23T10:38:46Z"
Next steps
- Check out the Example usage for more details on how to use them in your application.