Statistics Query
Basic query for statistics
Basic statistic query format
query: query includes following options items below for grouping. Note: Either of distinct option or aggregate option must be given.
NO
KEY
TYPE
REQUIRED
DESC
1
distinct
list
β
grouping in distinct condition with given items
2
aggregate
list
β
grouping and set fields for grouping
3
filter
list
β
filter out within operator
4
filter_or
list
β
filter out within operator
5
sort
dict
β
sorting a list with given keys
6
page
dict
β
set limit and its start page in grouping query to display
{
"query": {
"distinct": ...,
"aggregate": {...},
"filter": [...],
"filter_or": [...],
"sort": {...},
"limit":{...}
}
}{
"query": {
"distinct": "server_id"
}
}{ "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)
NO
KEY
TYPE
REQUIRED
DESC
1
unwind
list
β (conditional)
set of list to separate items within given paths
for more information at $unwind (aggregation)
2
group
list
β (conditional)
list of grouping keys and its alias
3
count
dict
β (conditional)
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)
NO
KEY
TYPE
REQUIRED
DESC
1
path
string
β
path to decomposable item
group specification : (type: dict)
NO
KEY
TYPE
REQUIRED
DESC
1
keys
list
β
list of grouping keys and its alias
2
fields
list
β
fields to express each alias with operators
keys specification : (type: list)
Note: each items in keys applies to given name(alias)
NO
KEY
TYPE
REQUIRED
DESC
1
key
string
β
key for grouping within declared resource type
2
name
string
β
alias when grouping with key
3
date_format
string
β
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)
NO
KEY
TYPE
REQUIRED
DESC
comment
1
key
string
β
list of grouping keys and its alias
You may omit key if operator is the count
2
name
string
β
field alias with name
3
operator
string
β
action perform with declared field.
4
value
string
β
The value of the declared field
You may omit value if operator is not date
5
date_format
string
β
format of value when it displays
You may omit date_format if operator is not date
Operators
NO
KEY
TYPE
DESC
1
count
string
count of grouped items by given key
2
sum
string
sum of grouped items by given key
3
avg
string
average of grouped items by given key
4
max
string
maximum value of grouped items by given key
5
min
string
minimum value of grouped items by given key
6
size
string
get length of list of grouped items by given key
9
date
string
date of specific calculation based on give value with date_format
count specification : (type: dict)
NO
KEY
TYPE
REQUIRED
DESC
1
name
list
β
name(alias) of counts in aggregate
NOTE:
filter and filter_or input simultaneously, it performs π AND π condition between them.
NO
KEY
TYPE
REQUIRED
DESC
1
key
string
β
any key that to filter out
2
value
list or any
β
3
operator
string
β
refer to operator below
Operators refer to Filter Operators
NOTE:
filter and filter_or input simultaneously, it performs π AND π condition between them.
KEY
TYPE
REQUIRED
DESC
key
string
β
any key that to filter out
value
list or any
β
operator
string
β
refer to operator below
Operators refer to Filter Operators
KEY
TYPE
REQUIRED
DESC
name
string
β
string sorting priority
desc
boolean
β
ascending or descending order Y/N
KEY
TYPE
REQUIRED
DESC
start
integer
β
start number
limit
integer
β
number of limit on selected
Last updated
Was this helpful?