The following JSON fields can be used in a query to operate on dimension values.
DimensionSpec
s define how dimension values get transformed prior to aggregation.
Returns dimension values as is and optionally renames the dimension.
{ "type" : "default", "dimension" : <dimension>, "outputName": <output_name> }
Returns dimension values transformed using the given DimExtractionFn
{ "type" : "extraction", "dimension" : <dimension>, "outputName" : <output_name>, "dimExtractionFn" : <dim_extraction_fn> }
DimExtractionFn
s define the transformation applied to each dimenion value
Returns the first group matched by the given regular expression. If there is no match it returns the dimension value as is.
{ "type" : "regex", "expr", <regular_expression> }
Returns the dimension value as is if there is a match, otherwise returns null.
{ "type" : "partial", "expr", <regular_expression> }
Returns the dimension value as is if the given SearchQuerySpec matches, otherwise returns null.
{ "type" : "searchQuery", "query" : <search_query_spec> }
Parses dimension values as timestamps using the given input format, and returns them formatted using the given output format. Time formats follow the com.ibm.icu.text.SimpleDateFormat format
{ "type" : "time", "timeFormat" : <input_format>, "resultFormat" : <output_format> }
Returns the dimension value as transformed by the given JavaScript function.
Example
{ "type" : "javascript", "function" : "function(str) { return str.substr(0, 3); }" }