Searching tickets

Searching tickets

Full text searches return results from all the data in your Zendesk. To search exclusively for ticket data, you can use ticket property keywords.

status:open

In the example above, status is the keyword and open is the value. This search returns all the tickets with status set to open. This of course directly maps to the ticket fields and their values.

You can combine these keyword search statements to narrow your results even further.
status:open group:"Level 2"

This returns all the open tickets that are assigned to the Level 2 support group.

Note: For a quick reference to all data that can be searched, see Zendesk search reference.

The ticket property keywords and their values that you can use in your searches are described in the following table. Not all of the ticket data is searchable. Administrators and agents can search for tickets using these keywords.

Table 1. Searchable ticket properties
Keyword Description
Ticket ID
There isn't a property keyword for the ticket ID. Instead, you simply search for the ticket by its ID number in the following format:
233
created The date the ticket was created.
created:2011-05-01
updated The date of the most recent ticket update.
updated>2011-05-15
solved The date the ticket was set to solved.
solved<2011-06-01
due_date The due date of tickets with type set to Task.
due_date:2011-06-01
assignee The assigned agent.
assignee:"Susan Warren"
submitter The ticket submitter. This may be different than the requester if the ticket was submitted by an agent on behalf of the requester. You can use the user's name, email address, or the 'me' keyword. See Searching ticket user roles.
submitter:me
requester The ticket requester.
requester:amy@mondocam.com
subject The text in the ticket's subject.
subject:"upgrade account"
description The text in all the ticket's comments.
description:defective
status Possible values: new, open, pending, hold, solved, closed.
status<closed
ticket_type Possible values: question, incident, problem, task.
ticket_type:problem
priority Possible values: low, normal, high, urgent.
priority>low
group The assigned agent's group name.
group:"Level 2"
organization The name of the ticket requester's organization.
organization:customers
tags Tags that have been added to the ticket.
status:pending tags:premium
via The ticket's source, which can be any of the following:
  • mail (from an email message)
  • get_satisfaction, get_sat, "get satisfaction" (from Get Satisfaction)
  • dropbox (from the Zendesk Feedback Tab)
  • chat (from Chat)
  • twitter_dm, "twitter dm", "twitter direct" (from a Twitter direct message)
  • twitter_fav, twitter_favorite, "twitter favorite" (from a Twitter favorite)
  • twitter (from any Twitter method including direct message and favorite)
  • voicemail (from a voicemail message)
  • phone_call_inbound (from an inbound phone call)
  • phone_call_outbound (from an outbound phone call)
  • phone (from voicemail or an inbound call)
  • sms, text, "text message" (from a text message)
  • logmein, logmein_rescue, "logmein rescue" (from LogMeIn)
via:phone
commenter People who have added comments to tickets.
commenter:"Mike"
You can search by a user's ID, a partial name, full name, and using an email address.
cc People who have been CC'd on tickets.
cc:amanda@mondocam.com
You can search by a user's ID, a partial name, full name, and using an email address.

All of the ticket property keywords can be used in search statements alone, in combination with other ticket property keywords, or with the type keyword (see Using the type keyword).

Searching ticket user roles

Users have various roles on tickets (requester, assignee, etc). These user roles can be searched by the user's ID, their name (partial or full), or their email address, as in these examples:

requester:52789480
submitter:amy
assignee:"amy moore"
requester:amy@mondocam.com

Notice that none of these searches required the ID, or name, or email to be explicitly declared. Each of these keywords accepts all of these user identifiers.

Searching for yourself

The me keyword value allows you to search user properties in tickets where the value is your own user account (as the currently logged in user).

assignee:me
This works for all the user role properties in tickets:
  • requester:me
  • submitter:me
  • assignee:me

For information about searching for user profile data, see Searching users.

Searching custom ticket fields

You can search for a specific value in custom ticket fields by using the fieldvalue keyword. For example:

fieldvalue:12345

This returns all the tickets that have a custom field with the value "12345."

If your custom field assigns a tag to the ticket, you can also search for custom ticket fields using the tags that you assigned to the custom field. For example, if you created a drop-down list, you can search for the tags assigned to each list box item.

To search for specific drop-down list selections, you use the tags keyword.

tags:product_question

This applies to the custom field formats that be assigned tags: the drop-down list and the checkbox. The checkbox custom field can include a tag to indicate that the user has clicked the checkbox.

All of the other custom fields (text, multi-line text, numeric, decimal, regular expression) can be searched by the text or number values submitted by ticket requesters. For example, if you added a numeric custom field to the support request form to collect demographic information such as age, you can search for the numbers that the requesters entered in the form (type:ticket "18").

Ordering and sorting ticket search results

Search results can be ordered and sorted using the order_by and sort keywords.

You need to use both of the keywords together in a search statement, as in this example:
status:new order_by:updated_at sort:asc

Here are the valid sorting and ordering keyword and value pairs that you can use:

  • sort:asc
  • sort:desc
  • order_by:priority
  • order_by:status
  • order_by:ticket_type
  • order_by:updated_at
  • order_by:created_at

All of the order_by and sort keyword/values pairs can be used when searching ticket data.

Have more questions? Submit a request

Comments

  • Avatar
    Pat

    Great Help article.  I was able to extract everything I wanted with one exception.  I want to know how many tickets were merged so I can delete them from the total count.  It looks as if the operator I should be using is via:merge but when I use it in the following 

    updated>2012-09-01 updated<2012-09-30 via:merge

    I get zero results and I know there are merged tickets.  What is the proper syntax to get merged tickets in a date range.  Sweeter yet what is the syntax to get the number of unique tickets created for a month?  That is the end result I am trying to get to.

  • Avatar
    Carlos Garcia Valencia

    Would it be possible to have on the results the same properties available with the old API, which are not longer on the results of the new API? : status_updated_at, linked_id, assigned_at, solved_at, etc...

    Regards 

  • Avatar
    Riley Withers

    I found these two search queries very useful in the Lotus interface:

    "foobar.com" order_by:created_at sort:desc 

    "what ever you need" order_by:updated_at sort:desc

  • Avatar
    David Rieger

    i need to do a query by custom field which is a textbox, any ideas? I have sent tickets and email but I am just dissapointed by 3 days of silence.

  • Avatar
    Laura D.

    Hi Drieger, 

    Sorry about the delay - I checked and it looks like Advanced Support was able to get back to you with some suggestions. Just in case anyone else is interested here's what they suggested:

    (This isn't quite what you're looking for but this might get you pretty close)

    Our API search end-point respects the same syntax that the Search tool in Zendesk uses and nothing more. Unfortunately there is not a way with Zendesk search to search for the values of a particular custom field. If you are using a drop down field though, each value for the field corresponds to a particular tag so you can use tag search to return tickets with a particular option selected. Just find the tag linked to the field value and do a search for 

    "tags:the_option_tag"

    That said, we do have a method that will let you search for values in all custom fields while excluding content in the subject field, ticket comments, etc. This is useful if you are trying to search for a number or character string entered in a custom field.

    To do this you just need to use syntax like the following:

    fieldvalue:5095

    That, in conjunction with other search terms, would limit the results to tickets that have '5095' entered into any of their custom fields.

  • Avatar
    Adam O'Brien

    Is there a way to search for records where a field value is null?

    In my specific case, I am in the process of cleaning up our Requester list and we have 1,000+ Requesters that do not have an associated Orginization... it would be extremely handy to be able to use something like 'Organization: -' or something to that effect that would allow me to easily sort out my Requester list.

  • Avatar
    Laura D.

    Hi Adam, 

    Would a search with "organization:none" help? I found that in one of our other different search references. 

  • Avatar
    Angel Metayer

    This is actually very complicated. Is this available in an easily accessible area in the ZD? 

  • Avatar
    Johannes

    Hi Laura,

    It would be nice to have ability to search for custom field (not drop down field) in ticket...

  • Avatar
    Laura D.

    Hi Johannes, 

    Just to understand a little better, you can do this (maybe not quite as easily as other options) as I mentioned above using the "fieldvalue:12345" (or with text), is there a different way you're looking for this to work?

  • Avatar
    Johannes

    Hi Laura,

    Thanks, I didn't read the whole trail of the comments.

    It would be nice to add this additional detail to the original forum description. At the end I use fieldvalue:keyword\searched_value_

     

  • Avatar
    Laura D.

    That's a good point - I'll ask Documentation to add a note :) Thanks!

  • Avatar
    Jennifer Rowe

    Thanks, Johannes and Laura. I added the "fieldvalue" keyword to the article.

  • Avatar
    Pete Rivett

    We have two separate custom fields: one for the release where a problem was found, the other for the release where it was fixed. Both have values such as 7.0.1956. How do we search for which tickets were fixed (as opposed to found) at a specific release? fieldvalue: finds those which were both fixed and found.

  • Avatar
    Ian LaPhilliph

    Hi Pete,

    Unfortunately there is not a way with Zendesk search to search for the values of a particular custom field. "Fieldvalue:" is going to pick up all custom fields that have 7.0.1956 entered.  As an alternative you could use a drop down menu rather then a text box as then you can search for the specific tag (using "tags:") that is left on ticket after a value is selected from the drop down menu.  

  • Avatar
    Andrew M

    Wow - how brain dead is that, if you can't specify the custom field you want to search! It's also inconsistent with searching for users / organizations, where it is possible to specify the custom field. I trust this is getting some development attention to rectify?

  • Avatar
    Andrew M

    We need to use custom fields to better integrate with our own application. To try and work round the fact that you can't search a specific field, I decided to include tags in the custom field. So I currently have 2 tickets with the same custom field value (";CCO=1;;CSO=2;;User=3;") - one ticket was created new with that value, and another ticket had the value added to it. This reveals the following problems:

    1) If I do a search for fieldvalue:"CCO=1" then only the ticket that was created new with the custom field shows up in the search results. There should have been 2 tickets found

    2) If I do a search for fieldvalue:"CCO=2" then I have the same results - but I would not expect any results, since that string does not occur within the field.

    Please advise

     

     

  • Avatar
    Andrew Meyercord

    Why is there no property keyword to search by Ticket ID? The guide says to just specify the ticket number as the search term with no property keyword, but then I have to filter for extraneous results that might get returned just because they happen to have that number in some other field.

  • Avatar
    Laura D.

    Andrew M, 

    Sorry for the delayed response.

    Search overall is an area we're working on across the board - you bring up a good point though. I don't have access to all of the details for our roadmap for search but I will do my best to find out about custom fields. I did some test searches in your account and I'm not sure what's going on - why some results are showing when they don't appear to have the content listed in the search. I'm going to do some research and I'll either post here if there's an answer that makes sense to share or start a ticket for you. It may take a little time to get an answer so please hang on for another day or two. 

     

    Andrew Meyercrod, 

    Usually when I search for a ticket by typing in the number, almost as soon as I've finished typing it (before Zendesk can search) I hit enter and Zendesk opens a tab with that ticket. If I let Zendesk search with the number I'll get a bunch of results for tickets that include that number somewhere in the comments or fields. Even if the search results populate, if your cursor is still in the search field, hitting enter should take you to the ticket. Hope that helps a bit!

  • Avatar
    Andrew Meyercord

    Thanks Laura, this advice will help when I'm searching from the web portal, but it doesn't help when I perform a search with the API. All of the irrelevant results that are returned when you let Zendesk complete the search are also returned when I perform an API search for a number. This requires me to write two searches to find a ticket by ID: one to get that big list of results that happen to include the number and then a second to step through the first list one-by one to find the ticket that actually has the ID number I'm looking for.

  • Avatar
    Andrew Meyercord

    I think I found my answer. An API search for a ticket by ID can be performed using GET /api/v2/tickets/{id}.json or for multiple tickets, POST /api/v2/tickets/show_many.json?ids={ids}

  • Avatar
    Laura D.

    Ah, I had not realized you were using the API - I'm glad you found what you needed though!

  • Avatar
    David Lim

    I'm using the API trying to get a list of tickets that don't have a tag. I'm building a separate automation that goes through new tickets and checks it against a different database. After the ticket has been checked, I was thinking of tagging it so the automation can skip it the next time a batch of tickets is requested from Zendesk. Is there a negation parameter or a different way to solve this problem?

  • Avatar
    Bob Novak

    Hi David - a negation parameter isn't going to work in this fashion for our API search. I think the best thing to do is make a View in your Zendesk that displays the tickets you want to process. This view can have a negative condition of [Ticket: tags][Contains none of the following][your\tag_]. Then you can use the API ( http://developer.zendesk.com/documentation/rest_api/views.html#getting-tickets-from-a-view) to get a list of tickets in the View, and have your external automation use that list for your batch. Please review the linked documentation carefully, as views that are called very frequently by an API client (more often than once every 5 minutes on average) may be cached by our software - so be aware of that if you will be doing this process frequently.

  • Avatar
    kumar bitla

    Hello. I'm using Zendesk API to get the ticket count based on tags. I need only the count, not the incident details which is not useful for me. If the number of ticket count is more then i am facing performance issue that unnecessary ticket information.

    Can anyone suggest me an API which will return the total number of tickets based on our search criteria.

     

    Thanks in Advance.

  • Avatar
    Andrew Meyercord

    Have you read the API documentation? A "count" property is returned with the first JSON object when you perform an API search.

    http://developer.zendesk.com/documentation/rest\_api/search.html

  • Avatar
    kumar bitla

    Hi Andrew. Thanks for the quick response.

    Actually I saw the "count"  property in Json object, Along with the count it is also returning a "results" property with incident details which is not useful for me. I need only the count of records.

    My requirement is when i perform search on tags with particular value,  i need only the number of tickets which are having my search criteria.** I don't require "results" parameter here which is having a huge data(which is not necessary for me)**. This is to increase the speed of my search.

    Ex:

    If my search query is like below

    https://mydomain.zendesk.com/api/v2/search.json?query=tags:test\_tag

    Let us assume, If this search returns record count  as 1000, then my Json object contains "results" property with 1000 incident details which i don't require(which hits the performance of my search).

    Is there any way to remove the "results" property from the Json object which contain only the count of incidents without "results" property, may be having other propertis like next_page,prev_page.

    Thanks in Advance.

  • Avatar
    Andrew Meyercord

    The API should only return to you the first 100 results of your query, along with a "next_page" property to allow you to retrieve the next 100 results. I wouldn't expect this to have much impact on your search performance, as the download should only be a few KB, I would think. There's no need to iterate the items in the result nor to request the next page, since you only want the "count" property anyway.

    If 100 results really is too many, you should be able to limit the page size by including the "per_page" parameter in your query, as described in the Collections section of the API introduction http://developer.zendesk.com/documentation/rest\_api/introduction.html#collections

    I hope this helps!

  • Avatar
    kumar bitla

    Thank you so much for your Help Andrew.. :)

  • Avatar
    Ben Pusey

    Hi I'm struggling to filter out multiple tags in my searches. If say I am trying to search a tag that is a customers company and critical I type in for example 

    type:ticket tags:y_prime critical

    However I get some tickets back that don't have critical tags and instead have low medium or high tags

    Another thing I don't understand is if I search it this way

    type:ticket tags:critical y_prime

    I get a different number of results back. I am trying to search by custom fields we setup which to my understanding use tags. Whats going on here? Is my syntax incorrect? I'm pretty sure the default for spaces was ands or something so I don't think this should be happening.

Please sign in to leave a comment.