This documentation supports the 21.3 (12.3) version of BMC Discovery.

Key expressions

The WHERE, ORDER BY and SHOW clauses often use simple attribute names, as in the examples describes in the using query language section. In some cases, however, a query needs more complex specifications.

The first option is to use a 'key expression' to retrieve information from related nodes. Key expressions start with a # character.

The key expression formats are:


Traverses from the node via the roles and relationships, returning the attribute of the target node. If more than one target can be reached, returns a list of up to 10 (or an alternative limit chosen in the system options).


As explained in the previous row, but returns a 'NodeHandle' for the target node, rather than an attribute of it, useful as a function argument.


Step in to a relationship and get its attribute.


Step in to a relationship and return a 'RelationshipHandle' for it, to pass into functions.


Step out of a relationship and get the destination node's attribute.


Step out of a relationship and return the destination 'NodeHandle'.


Return the node's id in hex string format.


Returns the node's datastore partition id.


Returns the node ID in binary format.


Returns a 'NodeHandle' for the node itself, to pass into various functions.


Returns the node itself.


Applies Python format string to the attributes (which can be key expressions) in the list.

So, extending the example of finding Windows hosts, this expression shows the IP addresses of the hosts' network interfaces:

SEARCH Host WHERE os_type = 'Windows' ORDER BY name SHOW name, ram,

The traversal syntax permits components to be wild-carded by leaving them blank. For example, the following query shows the names of all software running on a Host, both Business Application Instances and Software Instances:

SEARCH Host SHOW name,

Key expression name binding

Repeated key expressions can lead to long impenetrable search expressions. To avoid this, they can be bound to names. For example:

WITH #Host:HostedSoftware:RunningSoftware:SoftwareInstance AS si
SHOW name, EXPLODE si.type, si.version, si.count
Was this page helpful? Yes No Submitting... Thank you