Splunk Cloud

Search Reference

Download manual as PDF

Download topic as PDF



Returns typeahead information for a specified prefix. The maximum number of results returned is based on value you specify for the count argument. The typeahead command can be targeted to an index and restricted by time.


| typeahead prefix=<string> count=<int> [max_time=<int>] [<index=<string>] [<starttimeu=<int>] [<endtimeu=<int>] [collapse=<bool>]

Required arguments

Syntax: prefix=<string>
Description: The full search string to return typeahead information.
Syntax: count=<int>
Description: The maximum number of results to return.

Optional arguments

Syntax: index=<string>
Description: Search the specified index instead of the default index.
Syntax: max_time=<int>
Description: The maximum time in seconds that the typeahead can run. If max_time=0, there is no limit.
Syntax: starttimeu=<int>
Description: Set the start time to N seconds, measured in UNIX time.
Default: 0
Syntax: endtimeu=<int>
Description: Set the end time to N seconds, measured in UNIX time.
Default: now
Syntax: collapse=<bool>
Description: Specify whether to collapse a term that is a prefix of another term when the event count is the same.
Default: true

Typeahead and sourcetype renaming

After renaming the sourcetype in the props.conf file, it takes about 5 minutes (the exact time might slightly depend on the performance of the server) to clear up the cache data. A typeahead search that is run while the cache is being cleared returns the cached source type data. This is expected behavior.

To remove the cached data, in a terminal window run the following command:

rm $SPLUNK_HOME/var/run/splunk/typeahead/*, then re-run the typeahead search.

When you re-run the typeahead search, you should see the renamed source types.

For more information, see Rename source types in the Getting Data In manual.


The typeahead command is a generating command and should be the first command in the search. Generating commands use a leading pipe character.


Example 1:

Return typeahead information for sources in the "_internal" index.

| typeahead prefix=source count=10 index=_internal


Have questions? Visit Splunk Answers and see what questions and answers the Splunk community has using the typeahead command.


This documentation applies to the following versions of Splunk Cloud: 7.0.0, 6.5.1, 6.5.1612, 6.6.0, 6.6.1, 6.6.3, 6.5.0

Was this documentation topic helpful?

Enter your email address, and someone from the documentation team will respond to you:

Please provide your comments here. Ask a question or make a suggestion.

You must be logged into splunk.com in order to post comments. Log in now.

Please try to keep this discussion focused on the content covered in this documentation topic. If you have a more general question about Splunk functionality or are experiencing a difficulty with Splunk, consider posting a question to Splunkbase Answers.

0 out of 1000 Characters