An object storage system having object metadata query capability. Clients can pose queries to the object system in a high-level, declarative language. A query is evaluated against stored object metadata, and only objects satisfying the query's predicates are returned. The object storage system can evaluate alternative logical and physical query plans using a cost model. Queries can be posed using familiar REST-based APIs. The object storage system includes a distributed key-value store for secondary indexing of object metadata. A user can define secondary indexes considering the most common object access patterns.