"query": {
"aggregate": {
"unwind": [
{
"path": "collection_info.service_accounts"
}
],
"group": {
"keys": [
{
"key": "service_account_id",
"name": "service_account"
}
],
"fields": [
{
"operator": "count",
"name": "cloud_service_count"
}
]
},
"count": {
"name": "service_counts"
}
}
}
}
aggregate specification : (type: dict)
set of list to separate items within given paths
list of grouping keys and its alias
count of grouping results with given name
Either of 'group' or 'unwind' or 'count' must declare under aggregate parameters
Note: Applying order on aggregate
unwind > group > count
unwind specification : (type: list)
path to decomposable item
{
"unwind": [
{
"path": "collection_info.service_accounts"
}
]
}
group specification : (type: dict)
list of grouping keys and its alias
fields to express each alias with operators
{
"keys": [
{
"key": "service_account_id",
"name": "service_account"
}
],
"fields": [
{
"operator": "count",
"name": "cloud_service_count"
}
]
}
{
"keys": [
{
"key": "created_at",
"name": "created",
"date_format": "%Y-%m-%d"
}
],
"fields": [
{
"key" : "values.success_count"
"name": "success_count"
"operator": "max",
},
{
"key" : "values.fail_count"
"name": "fail_count"
"operator": "max",
},
{
"name": "year",
"value": "now/d - 7d",
"operator": "date",
"date_format": "%Y"
},
{
"name": "month",
"value": "now/d - 7d",
"operator": "date",
"date_format": "%m"
},
{
"name": "day",
"value": "now/d - 7d",
"operator": "date",
"date_format": "%d"
}
]
}
keys specification : (type: list)
Note: each items in keys applies to given name(alias)
key for grouping within declared resource type
alias when grouping with key
format the date data if given key has selected date format column such as created_at or update (purpose for grouping within Datetime
fields specification : (type: list)
list of grouping keys and its alias
You may omit key if operator is the count
action perform with declared field.
The value of the declared field
You may omit value if operator is not date
format of value when it displays
You may omit date_format if operator is not date
key can be omitted when operator is 'count'
value can be omitted when operator is NOT 'date'
date_format can be omitted when operator is NOT 'date'
Operators
count of grouped items by given key
sum of grouped items by given key
average of grouped items by given key
maximum value of grouped items by given key
minimum value of grouped items by given key
get length of list of grouped items by given key
date of specific calculation based on give value with date_format
count specification : (type: dict)
name(alias) of counts in aggregate