Query filters

Filters - 图1info

Apache Druid supports two query languages: Druid SQL and native queries. This document describes the native language. For information about aggregators available in SQL, refer to the SQL documentation.

A filter is a JSON object indicating which rows of data should be included in the computation for a query. It’s essentially the equivalent of the WHERE clause in SQL. Filters are commonly applied on dimensions, but can be applied on aggregated metrics, for example, see Filtered aggregator and Having filters.

By default, Druid uses SQL compatible three-value logic when filtering. See Boolean logic for more details.

Apache Druid supports the following types of filters.

Selector filter

The simplest filter is a selector filter. The selector filter matches a specific dimension with a specific value. Selector filters can be used as the base filters for more complex Boolean expressions of filters.

PropertyDescriptionRequired
typeMust be “selector”.Yes
dimensionInput column or virtual column name to filter on.Yes
valueString value to match.No. If not specified the filter matches NULL values.
extractionFnExtraction function to apply to dimension prior to value matching. See filtering with extraction functions for details.No

The selector filter can only match against STRING (single and multi-valued), LONG, FLOAT, DOUBLE types. Use the newer null and equality filters to match against ARRAY or COMPLEX types.

When the selector filter matches against numeric inputs, the string value will be best-effort coerced into a numeric value.

Example: equivalent of WHERE someColumn = 'hello'

  1. { "type": "selector", "dimension": "someColumn", "value": "hello" }

Example: equivalent of WHERE someColumn IS NULL

  1. { "type": "selector", "dimension": "someColumn", "value": null }

Equality Filter

The equality filter is a replacement for the selector filter with the ability to match against any type of column. The equality filter is designed to have more SQL compatible behavior than the selector filter and so can not match null values. To match null values use the null filter.

Druid’s SQL planner uses the equality filter by default instead of selector filter whenever druid.generic.useDefaultValueForNull=false, or if sqlUseBoundAndSelectors is set to false on the SQL query context.

PropertyDescriptionRequired
typeMust be “equality”.Yes
columnInput column or virtual column name to filter on.Yes
matchValueTypeString specifying the type of value to match. For example STRING, LONG, DOUBLE, FLOAT, ARRAY<STRING>, ARRAY<LONG>, or any other Druid type. The matchValueType determines how Druid interprets the matchValue to assist in converting to the type of the matched column.Yes
matchValueValue to match, must not be null.Yes

Example: equivalent of WHERE someColumn = 'hello'

  1. { "type": "equals", "column": "someColumn", "matchValueType": "STRING", "matchValue": "hello" }

Example: equivalent of WHERE someNumericColumn = 1.23

  1. { "type": "equals", "column": "someNumericColumn", "matchValueType": "DOUBLE", "matchValue": 1.23 }

Example: equivalent of WHERE someArrayColumn = ARRAY[1, 2, 3]

  1. { "type": "equals", "column": "someArrayColumn", "matchValueType": "ARRAY<LONG>", "matchValue": [1, 2, 3] }

Null Filter

The null filter is a partial replacement for the selector filter. It is dedicated to matching NULL values.

Druid’s SQL planner uses the null filter by default instead of selector filter whenever druid.generic.useDefaultValueForNull=false, or if sqlUseBoundAndSelectors is set to false on the SQL query context.

PropertyDescriptionRequired
typeMust be “null”.Yes
columnInput column or virtual column name to filter on.Yes

Example: equivalent of WHERE someColumn IS NULL

  1. { "type": "null", "column": "someColumn" }

Column comparison filter

The column comparison filter is similar to the selector filter, but compares dimensions to each other. For example:

PropertyDescriptionRequired
typeMust be “selector”.Yes
dimensionsList of DimensionSpec to compare.Yes

dimensions is list of DimensionSpecs, making it possible to apply an extraction function if needed.

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: equivalent of WHERE someColumn = someLongColumn

  1. {
  2. "type": "columnComparison",
  3. "dimensions": [
  4. "someColumn",
  5. {
  6. "type" : "default",
  7. "dimension" : someLongColumn,
  8. "outputType": "LONG"
  9. }
  10. ]
  11. }

Logical expression filters

AND

PropertyDescriptionRequired
typeMust be “and”.Yes
fieldsList of filter JSON objects, such as any other filter defined on this page or provided by extensions.Yes

Example: equivalent of WHERE someColumn = 'a' AND otherColumn = 1234 AND anotherColumn IS NULL

  1. {
  2. "type": "and",
  3. "fields": [
  4. { "type": "equals", "column": "someColumn", "matchValue": "a", "matchValueType": "STRING" },
  5. { "type": "equals", "column": "otherColumn", "matchValue": 1234, "matchValueType": "LONG" },
  6. { "type": "null", "column": "anotherColumn" }
  7. ]
  8. }

OR

PropertyDescriptionRequired
typeMust be “or”.Yes
fieldsList of filter JSON objects, such as any other filter defined on this page or provided by extensions.Yes

Example: equivalent of WHERE someColumn = 'a' OR otherColumn = 1234 OR anotherColumn IS NULL

  1. {
  2. "type": "or",
  3. "fields": [
  4. { "type": "equals", "column": "someColumn", "matchValue": "a", "matchValueType": "STRING" },
  5. { "type": "equals", "column": "otherColumn", "matchValue": 1234, "matchValueType": "LONG" },
  6. { "type": "null", "column": "anotherColumn" }
  7. ]
  8. }

NOT

PropertyDescriptionRequired
typeMust be “not”.Yes
fieldFilter JSON objects, such as any other filter defined on this page or provided by extensions.Yes

Example: equivalent of WHERE someColumn IS NOT NULL

  1. { "type": "not", "field": { "type": "null", "column": "someColumn" }}

In filter

The in filter can match input rows against a set of values, where a match occurs if the value is contained in the set.

PropertyDescriptionRequired
typeMust be “in”.Yes
dimensionInput column or virtual column name to filter on.Yes
valuesList of string value to match.Yes
extractionFnExtraction function to apply to dimension prior to value matching. See filtering with extraction functions for details.No

If an empty values array is passed to the “in” filter, it will simply return an empty result.

If the values array contains null, the “in” filter matches null values. This differs from the SQL IN filter, which does not match NULL values.

Example: equivalent of WHERE outlaw IN ('Good', 'Bad', 'Ugly')

  1. {
  2. "type": "in",
  3. "dimension": "outlaw",
  4. "values": ["Good", "Bad", "Ugly"]
  5. }

Bound filter

Bound filters can be used to filter on ranges of dimension values. It can be used for comparison filtering like greater than, less than, greater than or equal to, less than or equal to, and “between” (if both “lower” and “upper” are set).

PropertyDescriptionRequired
typeMust be “bound”.Yes
dimensionInput column or virtual column name to filter on.Yes
lowerThe lower bound string match value for the filter.No
upperThe upper bound string match value for the filter.No
lowerStrictBoolean indicating whether to perform strict comparison on the lower bound (“>” instead of “>=”).No, default: false
upperStrictBoolean indicating whether to perform strict comparison on the upper bound (“<” instead of “<=”).No, default: false
orderingString that specifies the sorting order to use when comparing values against the bound. Can be one of the following values: “lexicographic”, “alphanumeric”, “numeric”, “strlen”, “version”. See Sorting Orders for more details.No, default: “lexicographic”
extractionFnExtraction function to apply to dimension prior to value matching. See filtering with extraction functions for details.No

When the bound filter matches against numeric inputs, the string lower and upper bound values are best-effort coerced into a numeric value when using the "numeric" mode of ordering.

The bound filter can only match against STRING (single and multi-valued), LONG, FLOAT, DOUBLE types. Use the newer range to match against ARRAY or COMPLEX types.

Note that the bound filter matches null values if you don’t specify a lower bound. Use the range filter if SQL-compatible behavior.

Example: equivalent to WHERE 21 <= age <= 31

  1. {
  2. "type": "bound",
  3. "dimension": "age",
  4. "lower": "21",
  5. "upper": "31" ,
  6. "ordering": "numeric"
  7. }

Example: equivalent to WHERE 'foo' <= name <= 'hoo', using the default lexicographic sorting order

  1. {
  2. "type": "bound",
  3. "dimension": "name",
  4. "lower": "foo",
  5. "upper": "hoo"
  6. }

Example: equivalent to WHERE 21 < age < 31

  1. {
  2. "type": "bound",
  3. "dimension": "age",
  4. "lower": "21",
  5. "lowerStrict": true,
  6. "upper": "31" ,
  7. "upperStrict": true,
  8. "ordering": "numeric"
  9. }

Example: equivalent to WHERE age < 31

  1. {
  2. "type": "bound",
  3. "dimension": "age",
  4. "upper": "31" ,
  5. "upperStrict": true,
  6. "ordering": "numeric"
  7. }

Example: equivalent to WHERE age >= 18

  1. {
  2. "type": "bound",
  3. "dimension": "age",
  4. "lower": "18" ,
  5. "ordering": "numeric"
  6. }

Range filter

The range filter is a replacement for the bound filter. It compares against any type of column and is designed to have has more SQL compliant behavior than the bound filter. It won’t match null values, even if you don’t specify a lower bound.

Druid’s SQL planner uses the range filter by default instead of bound filter whenever druid.generic.useDefaultValueForNull=false, or if sqlUseBoundAndSelectors is set to false on the SQL query context.

PropertyDescriptionRequired
typeMust be “range”.Yes
columnInput column or virtual column name to filter on.Yes
matchValueTypeString specifying the type of bounds to match. For example STRING, LONG, DOUBLE, FLOAT, ARRAY<STRING>, ARRAY<LONG>, or any other Druid type. The matchValueType determines how Druid 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.Yes
lowerLower bound value to match.No. At least one of lower or upper must not be null.
upperUpper bound value to match.No. At least one of lower or upper must not be null.
lowerOpenBoolean indicating if lower bound is open in the interval of values defined by the range (“>” instead of “>=”).No
upperOpenBoolean indicating if upper bound is open on the interval of values defined by range (“<” instead of “<=”).No

Example: equivalent to WHERE 21 <= age <= 31

  1. {
  2. "type": "range",
  3. "column": "age",
  4. "matchValueType": "LONG",
  5. "lower": 21,
  6. "upper": 31
  7. }

Example: equivalent to WHERE 'foo' <= name <= 'hoo', using STRING comparison

  1. {
  2. "type": "range",
  3. "column": "name",
  4. "matchValueType": "STRING",
  5. "lower": "foo",
  6. "upper": "hoo"
  7. }

Example: equivalent to WHERE 21 < age < 31

  1. {
  2. "type": "range",
  3. "column": "age",
  4. "matchValueType": "LONG",
  5. "lower": "21",
  6. "lowerOpen": true,
  7. "upper": "31" ,
  8. "upperOpen": true
  9. }

Example: equivalent to WHERE age < 31

  1. {
  2. "type": "range",
  3. "column": "age",
  4. "matchValueType": "LONG",
  5. "upper": "31" ,
  6. "upperOpen": true
  7. }

Example: equivalent to WHERE age >= 18

  1. {
  2. "type": "range",
  3. "column": "age",
  4. "matchValueType": "LONG",
  5. "lower": 18
  6. }

Example: equivalent to WHERE ARRAY['a','b','c'] < arrayColumn < ARRAY['d','e','f'], using ARRAY comparison

  1. {
  2. "type": "range",
  3. "column": "name",
  4. "matchValueType": "ARRAY<STRING>",
  5. "lower": ["a","b","c"],
  6. "lowerOpen": true,
  7. "upper": ["d","e","f"],
  8. "upperOpen": true
  9. }

Like filter

Like filters can be used for basic wildcard searches. They are equivalent to the SQL LIKE operator. Special characters supported are “%” (matches any number of characters) and “_“ (matches any one character).

PropertyDescriptionRequired
typeMust be “like”.Yes
dimensionInput column or virtual column name to filter on.Yes
patternString LIKE pattern, such as “foo%” or “___bar”.Yes
escapeA string escape character that can be used to escape special characters.No
extractionFnExtraction function to apply to dimension prior to value matching. See filtering with extraction functions for details.No

Like filters support the use of extraction functions, see Filtering with Extraction Functions for details.

Example: equivalent of WHERE last_name LIKE "D%" (last_name starts with “D”)

  1. {
  2. "type": "like",
  3. "dimension": "last_name",
  4. "pattern": "D%"
  5. }

Regular expression filter

The regular expression filter is similar to the selector filter, but using regular expressions. It matches the specified dimension with the given pattern.

PropertyDescriptionRequired
typeMust be “regex”.Yes
dimensionInput column or virtual column name to filter on.Yes
patternString pattern to match - any standard Java regular expression.Yes
extractionFnExtraction function to apply to dimension prior to value matching. See filtering with extraction functions for details.No

Note that it is often more optimal to use a like filter instead of a regex for simple matching of prefixes.

Example: matches values that start with “50.”

  1. { "type": "regex", "dimension": "someColumn", "pattern": ^50.* }

Array contains element filter

The arrayContainsElement filter checks if an ARRAY contains a specific element but can also match against any type of column. When matching against scalar columns, scalar columns are treated as single-element arrays.

PropertyDescriptionRequired
typeMust be “arrayContainsElement”.Yes
columnInput column or virtual column name to filter on.Yes
elementMatchValueTypeString specifying the type of element value to match. For example STRING, LONG, DOUBLE, FLOAT, ARRAY<STRING>, ARRAY<LONG>, or any other Druid type. The elementMatchValueType determines how Druid interprets the elementMatchValue to assist in converting to the type of elements contained in the matched column.Yes
elementMatchValueArray element value to match. This value can be null.Yes

Example: equivalent of WHERE ARRAY_CONTAINS(someArrayColumn, 'hello')

  1. { "type": "arrayContainsElement", "column": "someArrayColumn", "elementMatchValueType": "STRING", "elementMatchValue": "hello" }

Example: equivalent of WHERE ARRAY_CONTAINS(someNumericArrayColumn, 1.23)

  1. { "type": "arrayContainsElement", "column": "someNumericArrayColumn", "elementMatchValueType": "DOUBLE", "elementMatchValue": 1.23 }

Example: equivalent of WHERE ARRAY_CONTAINS(someNumericArrayColumn, ARRAY[1, 2, 3])

  1. {
  2. "type": "and",
  3. "fields": [
  4. { "type": "arrayContainsElement", "column": "someNumericArrayColumn", "elementMatchValueType": "LONG", "elementMatchValue": 1 },
  5. { "type": "arrayContainsElement", "column": "someNumericArrayColumn", "elementMatchValueType": "LONG", "elementMatchValue": 2 },
  6. { "type": "arrayContainsElement", "column": "someNumericArrayColumn", "elementMatchValueType": "LONG", "elementMatchValue": 3 }
  7. ]
  8. }

Example: equivalent of WHERE ARRAY_OVERLAPS(someNumericArrayColumn, ARRAY[1, 2, 3])

  1. {
  2. "type": "or",
  3. "fields": [
  4. { "type": "arrayContainsElement", "column": "someNumericArrayColumn", "elementMatchValueType": "LONG", "elementMatchValue": 1 },
  5. { "type": "arrayContainsElement", "column": "someNumericArrayColumn", "elementMatchValueType": "LONG", "elementMatchValue": 2 },
  6. { "type": "arrayContainsElement", "column": "someNumericArrayColumn", "elementMatchValueType": "LONG", "elementMatchValue": 3 }
  7. ]
  8. }

Interval filter

The Interval filter enables range filtering on columns that contain long millisecond values, with the boundaries specified as ISO 8601 time intervals. It is suitable for the __time column, long metric columns, and dimensions with values that can be parsed as long milliseconds.

This filter converts the ISO 8601 intervals to long millisecond start/end ranges and translates to an OR of Bound filters on those millisecond ranges, with numeric comparison. The Bound filters will have left-closed and right-open matching (i.e., start <= time < end).

PropertyDescriptionRequired
typeMust be “interval”.Yes
dimensionInput column or virtual column name to filter on.Yes
intervalsA JSON array containing ISO-8601 interval strings that defines the time ranges to filter on.Yes
extractionFnExtraction function to apply to dimension prior to value matching. See filtering with extraction functions for details.No

The interval filter supports the use of extraction functions, see Filtering with Extraction Functions for details.

If an extraction function is used with this filter, the extraction function should output values that are parseable as long milliseconds.

The following example filters on the time ranges of October 1-7, 2014 and November 15-16, 2014.

  1. {
  2. "type" : "interval",
  3. "dimension" : "__time",
  4. "intervals" : [
  5. "2014-10-01T00:00:00.000Z/2014-10-07T00:00:00.000Z",
  6. "2014-11-15T00:00:00.000Z/2014-11-16T00:00:00.000Z"
  7. ]
  8. }

The filter above is equivalent to the following OR of Bound filters:

  1. {
  2. "type": "or",
  3. "fields": [
  4. {
  5. "type": "bound",
  6. "dimension": "__time",
  7. "lower": "1412121600000",
  8. "lowerStrict": false,
  9. "upper": "1412640000000" ,
  10. "upperStrict": true,
  11. "ordering": "numeric"
  12. },
  13. {
  14. "type": "bound",
  15. "dimension": "__time",
  16. "lower": "1416009600000",
  17. "lowerStrict": false,
  18. "upper": "1416096000000" ,
  19. "upperStrict": true,
  20. "ordering": "numeric"
  21. }
  22. ]
  23. }

True filter

A filter which matches all values. You can use it to temporarily disable other filters without removing them.

  1. { "type" : "true" }

False filter

A filter matches no values. You can use it to force a query to match no values.

  1. {"type": "false" }

Search filter

You can use search filters to filter on partial string matches.

  1. {
  2. "filter": {
  3. "type": "search",
  4. "dimension": "product",
  5. "query": {
  6. "type": "insensitive_contains",
  7. "value": "foo"
  8. }
  9. }
  10. }
PropertyDescriptionRequired
typeMust be “search”.Yes
dimensionInput column or virtual column name to filter on.Yes
queryA JSON object for the type of search. See search query spec for more information.Yes
extractionFnExtraction function to apply to dimension prior to value matching. See filtering with extraction functions for details.No

Search query spec

Contains

PropertyDescriptionRequired
typeMust be “contains”.Yes
valueA String value to search.Yes
caseSensitiveWhether the string comparison is case-sensitive or not.No, default is false (insensitive)

Insensitive contains

PropertyDescriptionRequired
typeMust be “insensitive_contains”.Yes
valueA String value to search.Yes

Note that an “insensitive_contains” search is equivalent to a “contains” search with “caseSensitive”: false (or not provided).

Fragment

PropertyDescriptionRequired
typeMust be “fragment”.Yes
valuesA JSON array of string values to search.Yes
caseSensitiveWhether the string comparison is case-sensitive or not.No, default is false (insensitive)

Expression filter

The expression filter allows for the implementation of arbitrary conditions, leveraging the Druid expression system. This filter allows for complete flexibility, but it might be less performant than a combination of the other filters on this page because it can’t always use the same optimizations available to other filters.

PropertyDescriptionRequired
typeMust be “expression”Yes
expressionExpression string to evaluate into true or false. See the Druid expression system for more details.Yes

Example: expression based matching

  1. {
  2. "type" : "expression" ,
  3. "expression" : "((product_type == 42) && (!is_deleted))"
  4. }

JavaScript filter

The JavaScript filter matches a dimension against the specified JavaScript function predicate. The filter matches values for which the function returns true.

PropertyDescriptionRequired
typeMust be “javascript”Yes
dimensionInput column or virtual column name to filter on.Yes
functionJavaScript function which accepts the dimension value as a single argument, and returns either true or false.Yes
extractionFnExtraction function to apply to dimension prior to value matching. See filtering with extraction functions for details.No

Example: matching any dimension values for the dimension name between 'bar' and 'foo'

  1. {
  2. "type" : "javascript",
  3. "dimension" : "name",
  4. "function" : "function(x) { return(x >= 'bar' && x <= 'foo') }"
  5. }

Filters - 图2info

JavaScript-based functionality is disabled by default. Please refer to the Druid JavaScript programming guide for guidelines about using Druid’s JavaScript functionality, including instructions on how to enable it.

Extraction filter

Filters - 图3info

The extraction filter is now deprecated. The selector filter with an extraction function specified provides identical functionality and should be used instead.

Extraction filter matches a dimension using a specific extraction function. The following filter matches the values for which the extraction function has a transformation entry input_key=output_value where output_value is equal to the filter value and input_key is present as a dimension.

PropertyDescriptionRequired
typeMust be “extraction”Yes
dimensionInput column or virtual column name to filter on.Yes
valueString value to match.No. If not specified the filter will match NULL values.
extractionFnExtraction function to apply to dimension prior to value matching. See filtering with extraction functions for details.No

Example: matching dimension values in [product_1, product_3, product_5] for the column product

  1. {
  2. "filter": {
  3. "type": "extraction",
  4. "dimension": "product",
  5. "value": "bar_1",
  6. "extractionFn": {
  7. "type": "lookup",
  8. "lookup": {
  9. "type": "map",
  10. "map": {
  11. "product_1": "bar_1",
  12. "product_5": "bar_1",
  13. "product_3": "bar_1"
  14. }
  15. }
  16. }
  17. }
  18. }

Filtering with extraction functions

All filters except the “spatial” filter support extraction functions. An extraction function is defined by setting the “extractionFn” field on a filter. See Extraction function for more details on extraction functions.

If specified, the extraction function will be used to transform input values before the filter is applied. The example below shows a selector filter combined with an extraction function. This filter will transform input values according to the values defined in the lookup map; transformed values will then be matched with the string “bar_1”.

Example: matches dimension values in [product_1, product_3, product_5] for the column product

  1. {
  2. "filter": {
  3. "type": "selector",
  4. "dimension": "product",
  5. "value": "bar_1",
  6. "extractionFn": {
  7. "type": "lookup",
  8. "lookup": {
  9. "type": "map",
  10. "map": {
  11. "product_1": "bar_1",
  12. "product_5": "bar_1",
  13. "product_3": "bar_1"
  14. }
  15. }
  16. }
  17. }
  18. }

Column types

Druid supports filtering on timestamp, string, long, and float columns.

Note that only string columns and columns produced with the ‘auto’ ingestion spec also used by type aware schema discovery have bitmap indexes. Queries that filter on other column types must scan those columns.

Filtering on multi-value string columns

All filters return true if any one of the dimension values is satisfies the filter.

Example: multi-value match behavior

Given a multi-value STRING row with values ['a', 'b', 'c'], a filter such as

  1. { "type": "equals", "column": "someMultiValueColumn", "matchValueType": "STRING", "matchValue": "b" }

will successfully match the entire row. This can produce sometimes unintuitive behavior when coupled with the implicit UNNEST functionality of Druid GroupBy and TopN queries.

Additionally, contradictory filters may be defined and perfectly legal in native queries which will not work in SQL.

Example: SQL “contradiction”

This query is impossible to express as is in SQL since it is a contradiction that the SQL planner will optimize to false and match nothing.

Given a multi-value STRING row with values ['a', 'b', 'c'], and filter such as

  1. {
  2. "type": "and",
  3. "fields": [
  4. {
  5. "type": "equals",
  6. "column": "someMultiValueColumn",
  7. "matchValueType": "STRING",
  8. "matchValue": "a"
  9. },
  10. {
  11. "type": "equals",
  12. "column": "someMultiValueColumn",
  13. "matchValueType": "STRING",
  14. "matchValue": "b"
  15. }
  16. ]
  17. }

will successfully match the entire row, but not match a row with value ['a', 'c'].

To express this filter in SQL, use SQL multi-value string functions such as MV_CONTAINS, which can be optimized by the planner to the same native filters.

Filtering on numeric columns

Some filters, such as equality and range filters allow accepting numeric match values directly since they include a secondary matchValueType parameter.

When filtering on numeric columns using string based filters such as the selector, in, and bounds filters, you can write filter match values as if they were strings. In most cases, your filter will be converted into a numeric predicate and will be applied to the numeric column values directly. In some cases (such as the “regex” filter) the numeric column values will be converted to strings during the scan.

Example: filtering on a specific value, myFloatColumn = 10.1

  1. {
  2. "type": "equals",
  3. "dimension": "myFloatColumn",
  4. "matchValueType": "FLOAT",
  5. "value": 10.1
  6. }

or with a selector filter:

  1. {
  2. "type": "selector",
  3. "dimension": "myFloatColumn",
  4. "value": "10.1"
  5. }

Example: filtering on a range of values, 10 <= myFloatColumn < 20

  1. {
  2. "type": "range",
  3. "column": "myFloatColumn",
  4. "matchvalueType": "FLOAT",
  5. "lower": 10.1,
  6. "lowerOpen": false,
  7. "upper": 20.9,
  8. "upperOpen": true
  9. }

or with a bound filter:

  1. {
  2. "type": "bound",
  3. "dimension": "myFloatColumn",
  4. "ordering": "numeric",
  5. "lower": "10",
  6. "lowerStrict": false,
  7. "upper": "20",
  8. "upperStrict": true
  9. }

Filtering on the timestamp column

Query filters can also be applied to the timestamp column. The timestamp column has long millisecond values. To refer to the timestamp column, use the string __time as the dimension name. Like numeric dimensions, timestamp filters should be specified as if the timestamp values were strings.

If you want to interpret the timestamp with a specific format, timezone, or locale, the Time Format Extraction Function is useful.

Example: filtering on a long timestamp value

  1. {
  2. "type": "equals",
  3. "dimension": "__time",
  4. "matchValueType": "LONG",
  5. "value": 124457387532
  6. }

or with a selector filter:

  1. {
  2. "type": "selector",
  3. "dimension": "__time",
  4. "value": "124457387532"
  5. }

Example: filtering on day of week using an extraction function

  1. {
  2. "type": "selector",
  3. "dimension": "__time",
  4. "value": "Friday",
  5. "extractionFn": {
  6. "type": "timeFormat",
  7. "format": "EEEE",
  8. "timeZone": "America/New_York",
  9. "locale": "en"
  10. }
  11. }

Example: filtering on a set of ISO 8601 intervals

  1. {
  2. "type" : "interval",
  3. "dimension" : "__time",
  4. "intervals" : [
  5. "2014-10-01T00:00:00.000Z/2014-10-07T00:00:00.000Z",
  6. "2014-11-15T00:00:00.000Z/2014-11-16T00:00:00.000Z"
  7. ]
  8. }