Available:array:exists()
v1.175.0
The array:exists()
function is available
from version 1.175.0.
The function filters events based on array contents. It checks if an array contains at least one element that meets a specified condition.
The array:exists()
function is useful when
array:contains()
is not flexible enough,
for example, when users want to compare the elements of the
array to the values of other fields or when they want to use
query functions in the condition.
Note
It is recommended to use the
array:contains()
function to check for
simple values. See array:contains()
.
Parameter | Type | Required | Default Value | Description |
---|---|---|---|---|
array [a] | string | required | Name of the array in which to search for matching elements. Must follow valid Array Syntax for array of scalars. For example, for events with fields incidents[0], incidents[1], ... this would be incidents[] . | |
condition | non-aggregate pipeline | required | A non-aggregate pipeline. If an event passes through the pipeline, the event is included, otherwise it is excluded. | |
var | string | optional[b] | input array name. | Name of the variable to be used in the condition argument. |
[b] Optional parameters use their default value unless explicitly set. |
The array:exists()
function can use other
filter functions, such as in()
or
if()
, or pipelines.
Note that for structured arrays, the
objectArray:exists()
function must be used
instead of the array:exists()
function. For
more information, see objectArray:exists()
.
For a complete list of functions for flat arrays, see
Array Query Functions.
array:exists()
Examples
Click
next to an example below to get the full details.Check For Existence of Element Larger Than Given Number
Check for the existence of an element larger than a given number in a flat array using array:exists()
function
Check For Existence of Simple Values in Nested Array Using objectArray:exists()
Check for the existence of simple values in nested array using objectArray:exists()
function with array:exists()
as filter function