A large Slack server can amass tens of thousands of messages. As an administrator, you could be a part of dozens of channels across one Slack server. When you need to find information, you must be able to search messages that have information needed to answer questions or perform a specific task. Slack has a feature that lets you quickly search messages. The number of messages that you can search and how far back you can go depends on the Slack subscription plan that you have. If you have a paid plan, you can search more messages than with a free plan.
Performing a Simple Search
Slack has several ways that you can search a server for a phrase or word. For very simple searches, Slack has a search text box located at the top-right of the desktop browser window. This search box can be used to quickly search Slack for just one word or a phrase that will narrow down searches to messages that have a combined number of words.
Users familiar with search functions in a browser or mobile device app will recognize the text box where a phrase can be typed to find messages. The one difference between Slack and many other applications is that clicking this text box with your mouse will cause a popup window to display where you type the words that you want to use in your search.
The text box opens above the current channel. As you type a phrase into the text box, Slack will prompt you with server suggestions. If you have multiple Slack servers open, you can choose to search other servers instead of the one you administrate. When you are finished typing a search phrase, press "Enter" to search the default server chosen or choose another server from the list shown and then press "Enter."
The results display in a window that overlays the current Slack server. Should you decide to cancel the search, you can click the "X" button at the top-right corner. Clicking this button will close the search results, so make sure that you no longer need them when you click this button. You can also clear search results and start over by clicking the "Clear" button. This button will also clear the search phrase in Slack's search text box.
In this example, the simple search "test" was entered into the search text box. Luckily, one message contains the "test" search phrase, so the result displays in the search window. If you click any search result, Slack will take you to the channel and location of where the message was posted. You can then scroll up or down to view more messages surrounding the one that you found. With a simple search, you can find more than just one post. You can also use the search to find important conversations and information that will help you work.
Notice in the search result window that you have four tabs "Messages," "Files," "Channels," and "People." These tabs will tell you if the search phrased entered was found in other sections of the Slack server besides just messages. This means that you can search for channels, people or files using the Slack search feature.
Another way to perform a simple search is to use the slash command "/search" with a simple phrase, username or channel. The slash command also allows for more advanced searches, but you must know the right syntax to apply filters and modifiers. To perform a simple search, use the following syntax:
/search <search phrase>
Type the above syntax into your Slack server's message input text box, and Slack will search for all messages, channels, people and files with the phrase entered into the command. After you press "Enter," Slack opens the search results window seen earlier using the standard search text box.
Using Search with Modifiers
Modifiers are commands that restrict searches to a more defined result. When you use a simple search, you could have thousands of messages, files, people and channels that contain the search phrase. With thousands of results, it would take you too long to find the right message. Modifiers are specific to the slash command "/search," and they apply filters to your search to get more qualified results.
- From: Search for a phrase posted by a specified user account.
- In: Limit your search to a specified channel or user account name.
- Before, after, on and during: Use these four modifiers to limit a search by date or a date range.
- Has: Find messages that contain a specific emoji. The "has" modifier can also be used to find messages that are pinned, starred or contains a link.
Just like other slash commands, you must use the right syntax for the "/search" command for it to work. You can use one or several modifiers in a search slash command. The following search command is an example where Slack will find a phrase in only in posts from a specified user:
/search test from:@jennifer
In the above search command, only messages from the user account "@jennifer" will be searched for the term "test." If any messages are found, Slack opens a search results window that displays the results. It's the same search results window that displayed in previous examples using the search text box feature.
An even better modifier is the "in" modifier. The "in" modifier will limit search results to a given channel. When you have a large Slack server with dozens of channels and hundreds of users, using a simple search could return thousands of messages. With the "in" modifier, you can limit search to a specific channel.
The following search command will search for the phrase "test" in the "general" channel:
/search test in:#general
Notice that the channel name has a hashtag prefix. The hashtag prefix is what tells Slack that the name refers to a channel and not a user or general term. Any time you want to add a channel link to Slack, use the hashtag before the channel name when you post it. Slack turns the channel name into a link that users can click and open the channel in their Slack window.
Even searching by a user or channel can return numerous messages if the server has been in existence for a long while. You might want to reduce the number of messages based on a date. By limiting messages to a date range, you can further limit search results to a smaller data set to find exactly what you're searching for.
The following syntax searches for a message with "test" in it, but only messages posted after 9/1/2019:
/search test after:9/1/2019
The three different search commands will perform individual searches, but you can combine them to limit your search results even more. All three of these results could still potentially return thousands of results, but combining these three commands will limit results to posts that you want to view.
The following slash command will search for posts with the text "test" in them, only from the user account "@jennifer," in the #general channel only, and only messages that were posted after 9/1/2019:
/search test after:9/1/2019 in:#general from:@jennifer
The modifiers do not need to be in any particular order. As long as the syntax is correct, Slack will parse the modifiers and return search results that match the query. Any time you perform a new search, the results are displayed in a new window that overlays the current Slack server interface. From this window, you can add more modifiers and filters to your search.
Adding Filters to Search Results
In the first section, the Slack user interface was used to return results. The search slash command is the quickest, fastest way to type a search query into Slack, but this command also opens a new window in the Slack interface. In the Slack search results, you can see several filters and options to get more out of your results so that you can find exactly what you're searching for.
Before you can set any filters on your search results, you must perform any basic search. After the basic search, results will display where you can apply more filters. For example, you might first want to see all results available for a specific search term and then drill down slowly using the Slack search result interface. This type of search is beneficial when you have a vague idea of what you need to find but can't remember the exact search terms or channel where content can be found.
For this example, the same search will be done using a simple search. The simple search results will then be used to drill down and find more granular results. First, type the following search phrase into the search text box or using the slash command:
/search test from:@jennifer
The search results window displays. This search command finds all posts that contain the text "test" but only where the user account "@jennifer" posts the messages. After pressing "Enter," the search result window opens over the main Slack window.
The search results display four results, and one of these results is a file post. If you click the "Files" tab, you would only see the search result that contains the file. These tabs are one way to filter out results that you don't want to include to find exactly what you need to see in the result's window.
On the right side of the window is the multiple filters that you can add. The advantage of using this window rather than using modifiers with the slash command is that you can add and remove filters without performing a new search. For large queries, this can be much faster and more convenient than using slash commands as you can visualize results as you make changes to filters. Most filters in the right panel correspond with the modifiers you can use in the search slash command.
The first section of the right panel is a list of users on the Slack server. If you used any of these filters in your search command, the checkbox is already checked. Since the user account "@jennifer" was added as a modifier, it's checked in the filters. In this example, the "Jennifer" account already has the checkmark checked indicating that the filter has been applied. You can add and remove checks on each filter to add and remove a filter. If you don't see the user in the list, click the "More" link to open a window where more users accounts are displayed.
The second section is the "Channels and Direct Messages" filters. With this filter, you can check the channels that you want to see in search results. With no channels checked, all channels are searched. All search results will be displayed regardless of the channel when nothing is checked, but checking a channel will only display results found in the checked channel.
The "Date" section is where you can set a date range. Unlike the modifiers where you can set a range that's before or after a specified date, the filter in the search results window lets you set a starting and ending date. Use this filter to specify results that only fit within a specified date range.
The last, bottom panel displays two filters that are not available if you use the slash command. In the "More Options" section, you see two more filters. The "Only search my channels" filter will find messages in channels where you are a part of the group. The "Hide apps and bots" filter is useful for removing bots such as Slackbot and app messages. This filter will ensure that you only get messages from users within your channels.
As you get used to the Slack search functions and syntax, you can find messages more easily even when you have thousands of messages in your server instance.