The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Searching RT

Irene Steves and Bryce Mecum

2021-05-14

Searching through RT requires some knowledge of how RT does queries. This vignette provides a basic introduction to RT’s query syntax and some examples of how to make queries with this package. Best Practical’s Query Builder documentation and Ticket SQL wiki page highlight some of the key aspects of query-building and are useful to reference while learning.

Writing a query

The rt_ticket_search function makes it easy to search through your tickets. These are the fields that it will return by default, and that you can use to search with:

There are additional queryable fields such as FileName, ContentType, and Content, Requestor.Name that you can explore in the Query Builder (Search –> Tickets –> New Search).

These fields are some of the most commonly queried:

To build a query, you’ll want to use the following vocabulary:

Example queries

To search for all tickets in the “General” queue, we’d run the following:

result <- rt_ticket_search("Queue = 'General'")

Note that, by default, rt_ticket_search returns a data.frame or tibble (if installed).

You can search against multiple fields using AND or OR to combine them.

rt_ticket_search("Queue = 'General' AND Subject LIKE 'test'")

Use parentheses to group query parameters together for more advanced logic.

rt_ticket_search("(Status = 'new' OR Status = 'open') AND Queue = 'General'")

For numeric and date/time fields, you can use >, >=, <, and <= in addition to =.

rt_ticket_search("Started > '2018-04-04'")

You can also use special date syntax for more options.

rt_ticket_search("Created >= '2 days ago'")

One of the most common use-cases is searching through RT ticket content. Note that this will only work if your RT installation has full text indexing turned on.

result <- rt_ticket_search("Content LIKE 'Can you please advise'")

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.