Docs
DocumentationQuery ReferenceAPI Reference
Open Console→→
DocumentationQuery ReferenceAPI Reference

Introduction

Query reference overview

APL

IntroductionSample queriesAll features
Functions
Scalar functions
Array functions
Overview
array_concat
array_extract
array_iff
array_index_of
array_length
array_reverse
array_rotate_left
array_rotate_right
array_select_dict
array_shift_left
array_shift_right
array_slice
array_sort_asc
array_sort_desc
array_split
array_sum
bag_has_key
bag_keys
bag_pack
bag_zip
isarray
len
pack_array
pack_dictionary
strcat_array
Conditional functions
Overview
case
iff
Conversion functions
Overview
dynamic_to_json
ensure_field
isbool
toarray
tobool
todatetime
todouble, toreal
todynamic
tohex
toint, tolong
tostring
totimespan
Datetime functions
Overview
ago
datetime_add
datetime_diff
datetime_part
dayofmonth
dayofweek
dayofyear
endofday
endofmonth
endofweek
endofyear
getmonth
getyear
hourofday
monthofyear
now
startofday
startofmonth
startofweek
startofyear
unixtime_microseconds_todatetime
unixtime_milliseconds_todatetime
unixtime_nanoseconds_todatetime
unixtime_seconds_todatetime
week_of_year
GenAI functions
Overview
genai_concat_contents
genai_conversation_turns
genai_cost
genai_estimate_tokens
genai_extract_assistant_response
genai_extract_function_results
genai_extract_system_prompt
genai_extract_tool_calls
genai_extract_user_prompt
genai_get_content_by_index
genai_get_content_by_role
genai_get_pricing
genai_get_role
genai_has_tool_calls
genai_input_cost
genai_is_truncated
genai_message_roles
genai_output_cost
Hash functions
Overview
hash
hash_md5
hash_sha1
hash_sha256
hash_sha512
IP functions
Overview
format_ipv4
format_ipv4_mask
geo_info_from_ip_address
has_any_ipv4
has_any_ipv4_prefix
has_ipv4
has_ipv4_prefix
ipv4_compare
ipv4_is_in_range
ipv4_is_in_any_range
ipv4_is_match
ipv4_is_private
ipv4_netmask_suffix
ipv6_compare
ipv6_is_in_any_range
ipv6_is_in_range
ipv6_is_match
parse_ipv4
parse_ipv4_mask
Mathematical functions
Overview
abs
acos
asin
atan
atan2
cos
cot
degrees
exp
exp2
exp10
gamma
isfinite
isinf
isint
isnan
log
log2
log10
loggamma
max_of
min_of
not
pi
pow
radians
rand
range
round
set_difference
set_has_element
set_intersect
set_union
sign
sin
sqrt
tan
Metadata functions
Overview
column_ifexists
cursor_current
ingestion_time
Pair functions
Overview
find_pair
pair
parse_pair
Rounding functions
Overview
bin
bin_auto
ceiling
floor
String functions
Overview
base64_decode_toarray
base64_decode_tostring
base64_encode_fromarray
base64_encode_tostring
coalesce
countof
countof_regex
extract
extract_all
format_bytes
format_url
gettype
indexof
indexof_regex
isascii
isempty
isnotempty
isnotnull
isnull
parse_bytes
parse_csv
parse_json
parse_path
parse_url
parse_urlquery
quote
regex_quote
replace
replace_regex
replace_string
reverse
split
strcat
strcat_delim
strcmp
string_size
strlen
strrep
strip_ansi_escapes
substring
tolower
totitle
toupper
translate
trim
trim_end
trim_end_regex
trim_regex
trim_space
trim_start
trim_start_regex
unicode_codepoints_from_string
unicode_codepoints_to_string
url_decode
url_encode
SQL functions
Overview
parse_sql
format_sql
Time series functions
Overview
series_abs
series_acos
series_add
series_asin
series_atan
series_ceiling
series_cos
series_cosine_similarity
series_divide
series_dot_product
series_equals
series_exp
series_fft
series_fill_backward
series_fill_const
series_fill_forward
series_fill_linear
series_fir
series_floor
series_greater
series_greater_equals
series_ifft
series_iir
series_less
series_less_equals
series_log
series_magnitude
series_max
series_min
series_multiply
series_not_equals
series_pearson_correlation
series_pow
series_sign
series_sin
series_stats
series_stats_dynamic
series_subtract
series_sum
series_tan
Type functions
Overview
isimei
ismap
isreal
iscc
isstring
isutf8
Aggregation functions
Overview
arg_min
arg_max
avg
avgif
count
countif
dcount
dcountif
histogram
histogramif
make_list
make_list_if
make_set
make_set_if
max
maxif
min
minif
percentile
percentileif
percentiles_array
percentiles_arrayif
phrases
rate
spotlight
stdev
stdevif
sum
sumif
topk
topkif
variance
varianceif
Operators
Tabular operators
Overview
count
distinct
extend
extend-valid
externaldata
getschema
join
limit
lookup
make-series
mv-expand
order
parse
parse-kv
parse-where
project
project-away
project-keep
project-rename
project-reorder
redact
sample
search
sort
summarize
take
top
union
where
Scalar operators
Set membership operators
Overview
in
!in
in~
!in~
Logical
Numerical
String
Reference
Entity names
Map fields
Null values
Scalar data types
Set statement
Special field attributes
Migrate
Splunk SPL
SQL
Sumo Logic

MPL

Language featuresSample queriesMigrate
APL/Operators

search

This page explains how to use the search operator in APL.

The search operator in APL is used to perform a full-text search across multiple fields in a dataset. This operator allows you to locate specific keywords, phrases, or patterns, helping you filter data quickly and efficiently. You can use search to query logs, traces, and other data sources without the need to specify individual fields, making it particularly useful when you’re unsure where the relevant data resides.

Use search when you want to search multiple fields in a dataset, especially for ad-hoc analysis or quick lookups across logs or traces. It’s commonly applied in log analysis, security monitoring, and trace analysis, where multiple fields may contain the desired data.

Importance of the search operator

  • Versatility: It allows you to find a specific text or term across various fields within a dataset that they choose or select for their search, without the necessity to specify each field.
  • Efficiency: Saves time when you aren’t sure which field or datasets in APL might contain the information you are looking for.
  • User-friendliness: It’s particularly useful for users or developers unfamiliar with the schema details of a given database.

Usage

Syntax

APL
search [kind=CaseSensitivity] SearchPredicate

or

APL
search [kind=CaseSensitivity] [in (DatasetPattern)] SearchPredicate

Parameters

NameTypeRequiredDescription
CaseSensitivitystringA flag that controls the behavior of all string scalar operators, such as has, with respect to case sensitivity. Valid values are default, case_insensitive, case_sensitive. The options default and case_insensitive are synonymous, since the default behavior is case insensitive.
DatasetPatternstringA wildcard pattern to match datasets. The wildcard * is useful to match multiple datasets, but it increases query complexity and decreases performance.
SearchPredicatestring✓A Boolean expression to be evaluated for every event in the input. If it returns true, the record is outputted.

Returns

Returns all rows where the specified keyword appears in any field.

Search predicate syntax

The SearchPredicate allows you to search for specific terms in all fields of a dataset. The operator that will be applied to a search term depends on the presence and placement of a wildcard asterisk (*) in the term, as shown in the following table.

LiteralOperator
axiomkhas
*axiomkhassuffix
axiomk*hasprefix
*axiomk*contains
ax*igmatches regex

You can also restrict the search to a specific field, look for an exact match instead of a term match, or search by regular expression. The syntax for each of these cases is shown in the following table.

SyntaxExplanation
FieldName:StringLiteralThis syntax can be used to restrict the search to a specific field. The default behavior is to search all fields.
FieldName==StringLiteralThis syntax can be used to search for exact matches of a field against a string value. The default behavior is to look for a term-match.
Field matches regex StringLiteralThis syntax indicates regular expression matching, in which StringLiteral is the regex pattern.

Use boolean expressions to combine conditions and create more complex searches. For example, "axiom" and b==789 would result in a search for events that have the term axiom in any field and the value 789 in the b field.

Search predicate syntax examples

#SyntaxMeaning (equivalent where)Comments
1search "axiom"where * has "axiom"
2search field:"axiom"where field has "axiom"
3search field=="axiom"where field=="axiom"
4search "axiom*"where * hasprefix "axiom"
5search "*axiom"where * hassuffix "axiom"
6search "*axiom*"where * contains "axiom"
7search "Pad*FG"where * matches regex @"\bPad.*FG\b"
8search *where 0==0
9search field matches regex "..."where field matches regex "..."
10search kind=case_sensitiveAll string comparisons are case-sensitive
11search "axiom" and ("log" or "metric")where * has "axiom" and (* has "log" or * has "metric")
12search "axiom" or (A>a and A<b)where * has "axiom" or (A>a and A<b)
13search "AxI?OM"where * matches regex @"\bAxI.OM\b"? matches a single character
14search "axiom" and not field:"error"where * has "axiom" and not field has "error"Excluding a field from the search

Examples

Global term search

Search for a term over the dataset in scope.

APLRun in Playground
['sample-http-logs']
| search "image"

Conditional global term search

Search for records that match both terms in the dataset.

APLRun in Playground
['sample-http-logs']
| search "jpeg" and ("GET" or "true")

Case-sensitive search

Search for events that match both case-sensitive terms in the dataset.

APLRun in Playground
['sample-http-logs']
| search kind=case_sensitive "css"

Search specific fields

Search for a term in the method and user_agent fields in the dataset.

APLRun in Playground
['sample-http-logs']
| search method:"GET" or user_agent :"Mozilla"

Limit search by timestamp

Search for a term over the dataset if the term appears in an event with a date greater than the given date.

APLRun in Playground
['sample-http-logs']
| search "get" and _time > datetime('2022-09-16')

Use kind=default

By default, the search is case-insensitive and uses the simple search.

APLRun in Playground
['sample-http-logs']
| search kind=default "INDIA"

Use kind=case_sensitive

Search for logs that contain the term "text" with case sensitivity.

APLRun in Playground
['sample-http-logs']
| search kind=case_sensitive "text"

Use kind=case_insensitive

Explicitly search for logs that contain the term "CSS" without case sensitivity.

APLRun in Playground
['sample-http-logs']
| search kind=case_insensitive "CSS"

Use search *

Search all logs. This would essentially return all rows in the dataset.

APLRun in Playground
['sample-http-logs']
| search *

Contain any substring

Search for logs that contain any substring of brazil.

APLRun in Playground
['sample-http-logs']
| search "*brazil*"

Search for multiple independent terms

Search the logs for entries that contain either the term GET or covina, irrespective of their context or the fields they appear in.

APLRun in Playground
['sample-http-logs']
| search "GET" or "covina"

Search across multiple datasets with wildcards

Use the in clause with wildcards to search across multiple datasets matching a pattern:

APL
search in (github*) "error"

This searches for the term error across all datasets that start with github, such as github-push-event and github-pull-request-event. The wildcard * in in (github*) is useful to match multiple datasets, but it increases query complexity and decreases performance.

Use the search operator efficiently

Using non-field-specific filters such as the search operator has an impact on performance, especially when used over a high volume of events in a wide time range. To use the search operator efficiently, follow these guidelines:

  • Use field-specific filters when possible. Field-specific filters narrow your query results to events where a field has a given value. They're more efficient than non-field-specific filters, such as the search operator, that narrow your query results by searching across all fields for a given value. When you know the target field, replace the search operator with where clauses that filter for values in a specific field.
  • After using the search operator in your query, use other operators, such as project statements, to limit the number of returned fields.
  • Use the kind flag when possible. When you know the pattern that string values in your data follow, use the kind flag to specify the case-sensitivity of the search.
Was this page helpful?
Suggest edits on GitHub
PrevioussampleNextsort
On this page
Importance of the search operatorUsageSyntaxParametersReturnsSearch predicate syntaxSearch predicate syntax examplesExamplesGlobal term searchConditional global term searchCase-sensitive searchSearch specific fieldsLimit search by timestampUse kind=defaultUse kind=case_sensitiveUse kind=case_insensitiveUse search *Contain any substringSearch for multiple independent termsSearch across multiple datasets with wildcardsUse the search operator efficiently