Querying Resources

You can find Oracle Cloud Infrastructure resources in a tenancy by performing a free text search or running a query. A free text search finds resources with the specified text anywhere in the resource metadata. An advanced query lets you find resources according to specific fields and conditions by using query language. When finding resources, both free text searches and queries rely on resource indexing and the indexed attributes for a particular resource type. Search also scopes resource results to the selected region.

Note

Supported Resources and Using Advanced Resource Queries

The search results that you see reflect what Search considers supported resources. To see what Oracle Cloud Infrastructure services and resources Search supports, see the Supported Resources section of Overview of Search or see Listing Resource-Types Supported by Search.

Finding Instances

You can find instances (or a VNIC that comes with an instance) by entering an IPv4 or IPv6 address as a free text search. Additionally, in search results, Search offers an enhanced view of resource attributes for instance resources.

By default, search results display a limited, common set of resource attributes for any matching resource. In the Console, these resource attributes include the display name, resource type, OCID, compartment, lifecycle state, and time created. In the SDK or CLI, basic resource search results also include the availability domain and any tags associated with the resource.

You can see select additional details indexed for instance resources by applying the optional resource type filter to search results. To apply the resource type filter, you must first obtain search results by following any of the Console-based procedures in Performing a Free Text Search, Reusing Recent Search Terms, Running a Custom, Free-Form Query, or Running a Sample Query.

When you try to find instances by providing an IP address in the search box, the service treats it as a free text search. Everything about how the service treats free text searches applies, as described in Free Text Search, from matching and ranking of results to the use of wildcards. For example, you can enter the following IPv6 address:
68be:66d1:e4a1:ae53:6905:ecab:30a1:*

Search interprets the wildcard character in the last 16-bit field as described in Wildcards. The service then tries to match the translated search term against the values of all indexed resource attributes for all indexed resources. If the string appears in an indexed field, such as the IP address of an instance, then Search considers the found item a matching result and returns it in the list of results. If there is an instance with the IPv6 address 68be:66d1:e4a1:ae53:6905:ecab:30a1:a814, for example, you can filter by the instance resource type to get a detailed view of the search result and any other matching instance results.

For more information about performing a free text search and filtering results, see Performing a Free Text Search.

Finding Resources by OCID

You have multiple ways of finding a resource by its OCID . You can simply enter an OCID as a free text search. However, we recommend that you construct an advanced resource query instead. When constructing a query to find a resource by its OCID, you can either provide the OCID as part of a condition statement or as matching text. For example, to find a compartment with a specific OCID with a condition statement:

query compartment resources where identifier = 'ocid1.compartment.oc1..<unique_ID>'

For more information about this query syntax, see Conditions.

Or, for example, to find a compartment with a specific OCID with a matching clause:

query compartment resources matching 'ocid1.compartment.oc1..<unique_ID>'

For more information about this query syntax, see Matching.

All methods require you to provide the resource OCID in its entirety exactly.