Array Syntax

As a part of the LogScale Query Language, there is syntax that applies to array functions e.g., array:contains(), that we refer to as array syntax.

The array functions operate on fields that follow this specific naming conventions syntax.

The array syntax is similar to the one used by JSON, where [ and ] are used for indexing and . for selecting members in objects.

Fields with names consisting of a valid array-prefix followed by an array entry are treated as entries of an array. The indices must be continuously increasing from 0 and upwards.

The array is referenced by the array functions using the array-prefix followed by [] that indicates the entire range of entries.

Simplified, the valid array-prefix is a sequence of members and array entries. More formally, a valid array-prefix is either:

  • an identifier — that is, a sequence of alphabetical characters

  • a valid array-prefix followed by a member operator and an identifier — the member operator is a .

  • or a valid array-prefix followed by an array entry — the array entry is an index surrounded by square brackets.

Examples of field names representing entries in an array, and the reference to that array:

Field names following the array syntax How to reference in array functions
a[0], a[1], a[2] a[]
a.b[0], a.b[1], a.b[2] a.b[]
a[0][0], a[0][1] a[0][]

Warning

  • It is not possible to use the functions across entries containing objects or other arrays e.g., a[][0] and a[].b is invalid.

  • It is not possible to use the functions across compounded ranges of entries e.g., a[][] is also invalid.