Using the Query Language - Documentation for Bmc Discovery 22.1
This Topic Provides Information and Instructions for Using the Query Language. Search expressionsThe Query Language Provides a Natural Mechanism for Searching...
This topic provides information and instructions for using the query language.
Search expressions
The query language provides a natural mechanism for searching and processing the data model. The basic format of a search expression is:SEARCH [in partition] <kinds> [where clause] [traversals] [ordering] [show clause] [processing]
Used to search in a named partition. | |
| Used to specify the kinds of nodes to find. |
Used to filter the current set of nodes. | |
Used to define a traverse from one node to another in order to access attributes and relationships from related nodes. | |
Used to define a sort order for the results. | |
Used to define the information to return in the search results. | |
Used to post-process the results of a search. |
Must Read
Example of a query
As a simple example, the following query retrieves all Host objects where the OS is Microsoft Windows. It displays each host's name and how much RAM it has; the results are sorted by name.
SEARCH Host WHERE os_type = 'Windows' ORDER BY name SHOW name, ram
The following example finds all nodes that mention Microsoft:
SEARCH * WHERE * HAS SUBWORD "microsoft"
In this example, both the ordering and show clauses are absent. The search service therefore uses the taxonomy definitions to choose defaults. The results are ordered by the label attributes of each node kind found and the attributes to show are set according to the corresponding summary lists. (If no definitions are given in the taxonomy for a node kind, the results are not sorted and all attributes are shown.)
The following example searches the _System partition for Users:
search in "_System" FoundationUser show username
When writing search queries, you should be aware that an unconstrained search can have a serious performance impact on the appliance. For example, SEARCH * would return details of every node in the entire datastore!
The sets resulting from searches (and traversals) can be named and combined using set operations. This is described in Results Post Processing.