General functions
Functions with a general purpose.
in
Tests if a value is a member of an array
.
The in
function supports multiple haystacks and allows arrays in all arguments.
-
Syntax
in(needle, haystack, …)
-
Parameters
Name Type Mandatory Default Constraints Description element
array, boolean, double, duration, ip, long, record, string, timeframe, timestamp
yes
The element(s) to search for (the needle).
elements
array, boolean, double, duration, ip, long, record, string, timeframe, timestamp
yes
The elements where to search for the needle element (the haystack).
-
Example 1
1data record(a = "java"),2 record(a = "python"),3 record(a = "dotnet"),4 record(a = "rust")5| fieldsAdd in(a, "java", "go", "rust")Query result
a in(a, {"java", "go", "rust"}) java
true
python
false
dotnet
false
rust
true
-
Example 2
1data record(technologies = array("Java", "Spring", "Jetty")),2 record(technologies = array("Python", "Flask")),3 record(technologies = array("Java", "Hibernate"))4| fieldsAdd in(technologies, "Python", "Hibernate"),5 in(technologies, array("Spring", "Flask"))Query result
technologies in(technologies, {"Python", "Hibernate"}) in(technologies, array("Spring", "Flask")) [Java, Spring, Jetty]
false
true
[Python, Flask]
true
true
[Java, Hibernate]
true
false
record
Creates a record
from the keys and values of the parameter.
-
Syntax
record(expression, …)
-
Parameters
Name Type Mandatory Default Constraints Description expression
array, boolean, double, duration, ip, long, record, string, timeframe, timestamp
yes
An expression to add to the record.
-
Example
1data record(executable = "java", technologies = array("Java", "Spring", "Jetty")),2 record(executable = "python", technologies = array("Python", "Flask")),3 record(executable = "java", technologies = array("Java", "Jetty", "Hibernate"))Query result
executable technologies java
[Java, Spring, Jetty]
python
[Python, Flask]
java
[Java, Jetty, Hibernate]