All Products
Search
Document Center

Object Storage Service:Search for objects

Last Updated:Apr 29, 2024

If your bucket contains a large number of objects, you can search for and retrieve objects by prefix to improve search efficiency.

Limits

  • Search rules

    You can search for objects by prefix. A prefix is a string of characters at the beginning of the object name. The prefix string is case-sensitive and cannot contain forward slashes (/).

  • Search results

    When you specify a prefix to search for objects in the root directory or the specified directory of a bucket, only the objects or subdirectories whose names contain the specified prefix are returned.

    Note

    If you want to recursively search for objects or subdirectories in a directory of a bucket, you can use the GetBucket (ListObjects) operation or the ls command of ossutil.

Procedure

Use the OSS console

  1. Log on to the OSS console.

  2. In the left-side navigation pane, click Buckets. On the Buckets page, find and click the desired bucket.

  3. In the left-side navigation tree, choose Object Management > Objects.

  4. Search for objects.

    • Search for specific objects or directories in the root directory of the bucket

      Enter the prefix to search by in the search box and press Enter or click the search icon. Objects and directories whose names contain the specified prefix within the root directory are displayed.

      The following example shows the results of searching by prefix Example in the TestBucket bucket:

      Structure             Specified prefix          Search results
      TestBucket                         Example              Examplesrcfolder1                          
          └── Examplesrcfolder1                               Exampledestfolder.png                           
                 ├── test.txt                                
                 ├── abc.jpg
          └── Exampledestfolder.png
          └── example.txt
    • Search for specific objects or subdirectories in the specified directory of a bucket

      Click the directory name. Enter the prefix to search by in the search box and press Enter or click the search icon. Objects and subdirectories whose names contain the specified prefix in the directory are displayed.

      The following example shows the results of searching by prefix Project in the Examplesrcfolder1 directory of the bucket.

      Structure             Specified prefix          Search results
      Examplesrcfolder1           Project               Projectfolder
          └── Projectfolder                             ProjectA.jpg
                ├── a.txt                               ProjectB.doc
                ├── b.txt
          └── ProjectA.jpg
          └── ProjectB.doc
          └── projectC.doc

Use ossbrowser

You can use ossbrowser to perform the same bucket-level operations that you can perform in the OSS console. You can follow the on-screen instructions in ossbrowser to search for specific objects. For more information about how to use ossbrowser, see Use ossbrowser.