Filters
Introduction¶
A filter indicates which rows of data should be included in the computation for a query. It is essentially the equivalent of the WHERE clause in SQL. Filters can be chained and combined with the 'and', 'or' and 'not' operators into a tree of filters with one root filter.
By using filters in the filtered-aggregator cohorts of the complete data can be created and used in post-aggregations.
Specifics & Examples¶
Following you can find information regarding the different filters available and examples of their application.
Name: Selector - filter
Explanation: The selector filter matches rows where the value of a dimension is exactly equal to the specified value.
Example:
Property Reference
Property: dimension
Description: input column or virtual column name to filter on. To filter for a specific event the dimension is 'type' and the event-name to be used in the value-property. To filter for a specific parameter-value the parameter's name is to be used as dimension and the desired value in the value-property.
Required: true
Property: value
Description: string value to match (not required; if not specified the filter matches NULL values).
Required: false
Property: type
Description: must be 'selector'.
Required: true
Name: Column Comparison - filter
Explanation: The column comparison filter compares dimensions to each other. Note that the column comparison filter converts all values to strings prior to comparison. This allows differently-typed input columns to match without a cast operation.
Example:
Property Reference
Property: dimensions
Description: list of DimensionSpec to compare; makes it possible to apply an extraction function if needed.
Required: true
Property: type
Description: must be 'columnComparison'.
Required: true
Name: Logical Expression and - filter
Explanation: The and-filter combines multiple filters into a single filter that only matches rows that match all sub-filters.
Example:
{
"filter": {
"type": "and",
"fields": [
{
"type": "selector",
"dimension": "type",
"value": "TelemetryDeck.Session.started"
},
{
"type": "selector",
"dimension": "TelemetryDeck.AppInfo.version",
"value": "3.1.0"
}
]
}
}
Property Reference
Property: fields
Description: a list of filter JSON objects.
Required: true
Property: type
Description: must be 'and'.
Required: true
Name: Logical Expression or - filter
Explanation: The or-filter combines multiple filters into a single filter that matches rows that match any sub-filter.
Example:
{
"filter": {
"type": "or",
"fields": [
{
"type": "selector",
"dimension": "TelemetryDeck.AppInfo.version",
"value": "2.1.0"
},
{
"type": "selector",
"dimension": "TelemetryDeck.AppInfo.version",
"value": "3.1.0"
}
]
}
}
Property Reference
Property: fields
Description: a list of filter JSON objects.
Required: true
Property: type
Description: must be 'or'.
Required: true
Name: Logical Expression not - filter Explanation: The not-filter negates a filter i.e. events are returned that do not meet the criteria of the filter defined in the property 'field' of the not-filter. This enables to filter out rows with no value by negating a selector-filter with an empty value-property. Example:
{
"filter": {
"type": "not",
"field": {
"type": "selector",
"dimension": "TelemetryDeck.AppInfo.version",
"value": "2.1.0"
}
}
}
Property Reference
Property: field
Description: a filter JSON object.
Required: true
Property: type
Description: must be 'not'.
Requied: true
Name: Range - filter
Explanation: The range-filter can be used for comparison filtering like greater than, less than, greater than or equal to, less than or equal to, and 'between'.
Following are three examples (the purpose of this is to present three examples together - it is not a valid syntax to have three 'filter'-fields in a query):
- filter 1: 21 < age < 31
- filter 2: age < 31
- filter 3: 'foo' <= name <= 'hoo', using STRING comparisonExample:
{
"filter": {
"type": "range",
"column": "age",
"matchValueType": "DOUBLE",
"lower": "21",
"lowerOpen": true,
"upper": "31",
"upperOpen": true
},
"filter": {
"type": "range",
"column": "age",
"matchValueType": "DOUBLE",
"upper": "31",
"upperOpen": true
},
"filter": {
"type": "range",
"column": "name",
"matchValueType": "STRING",
"lower": "foo",
"upper": "hoo"
}
}
Property Reference
Property: column
Description: input column or virtual column name to filter on.
Required: true
Property: matchValueType
Description: specifies the type of bounds to match. It determines how TelemetryDeck interprets the matchValue to assist in converting to the type of the matched column and also defines the type of comparison used when matching values. Valid values are STRING and DOUBLE.
Required: true
Property: lower
Description: lower bound of the range (optional, but at least one of lower or upper must not be null).
Required: false
Property: lowerOpen
Description: if true, the lower bound is exclusive.
Required: false
Property: upper
Description: upper bound of the range (optional, but at least one of lower or upper must not be null).
Required: false
Property: upperOpen
Description: if true, the upper bound is exclusive.
Required: false
Property: type
Description: must be 'range'.
Required: true
Name: Regular Expression - filter
Explanation: The regex-filter is similar to the selector filter, but using regular expressions. It matches the specified dimension with the given pattern. The example is for values matching the criterion that they start with '50.'
Example:
Property Reference
Property: column
Description: input column or virtual column name to filter on.
Required: true
Property: pattern
Description: string pattern to match - any standard Java regular expression.
Required: true
Property: extractionFn
Description: extraction function to apply to dimension prior to value matching.
Required: false
Property: type
Description: must be 'regex'.
Required: true
Name: Interval - filter
Explanation: The interval filter enables range filtering on columns that contain long millisecond values, with the boundaries specified as ISO 8601 time intervals. Intervals can be relative or absolute. Absolute intervals are specified as a string in the format start/end, where start and end are ISO 8601 timestamps.
Following are two examples (the purpose of this is to present two examples together - it is not a valid syntax to have two 'filter'-fields in a query):
- absolute interval: two specified time ranges in October and November 2024
- relative interval: 30 days ago until todayExample:
{
"filter": {
"type": "interval",
"dimension": "__time",
"intervals": [
"2024-10-01T00:00:00.000Z/2024-10-07T00:00:00.000Z",
"2024-11-15T00:00:00.000Z/2024-11-16T00:00:00.000Z"
]
},
"filter": {
"type": "interval",
"dimension": "__time",
"relativeIntervals": [
{
"beginningDate": {
"component": "day",
"offset": -30,
"position": "beginning"
},
"endDate": {
"component": "day",
"offset": 0,
"position": "end"
}
}
]
}
}
Property Reference
Property: dimension
Description: input column or virtual column name to filter on, usually '__time'.
Required: true
Property: intervals
Description: in case of absolute intervals a JSON array containing ISO-8601 interval strings that defines the time ranges to filter on.
Required: true
Property: extractionFn
Description: extraction function to apply to dimension prior to value matching. An extraction function should output values that are parseable as long milliseconds.
Required: false
Property: type
Description: must be 'interval'.
Required: true