{"__v":1,"_id":"561ed6fd0a04340d00d8a0b0","category":{"__v":7,"_id":"54fdad6e660db63700c23b82","pages":["55fbef82af72eb0d0007df93","55fbf623e013770d008fcba8","5617bd3a26e3db230054fba4","5617c4a6f8c9632100ac74f5","561ed6fd0a04340d00d8a0b0","562156adf4e0352100cbf268","562a5c846049f20d0032520b"],"project":"54d0fd1d095c470d00d1646d","version":"54d0fd1e095c470d00d16470","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-03-09T14:25:50.133Z","from_sync":false,"order":2,"slug":"api-reference","title":"API Reference"},"editedParams":true,"editedParams2":true,"project":"54d0fd1d095c470d00d1646d","user":"54d0fc4b7493b40d00400243","version":{"__v":20,"_id":"54d0fd1e095c470d00d16470","project":"54d0fd1d095c470d00d1646d","createdAt":"2015-02-03T16:53:50.090Z","releaseDate":"2015-02-03T16:53:50.090Z","categories":["54d0fd1e095c470d00d16471","54d8b5e68934140d00496544","54db6361c6a4d40d0034b8f7","54db638208ea010d00ab1fdd","54db639008ea010d00ab1fde","54db6547c6a4d40d0034b8fd","54db83482092743700ea6ee1","54db84afc6a4d40d0034b93c","54db8805c6a4d40d0034b93f","54db8de9c6a4d40d0034b961","54db931ac6a4d40d0034b96d","54e49219e4365521006fd9ee","54e74fcc652d7c1900cbe737","54e74ffd3c1e111700d05762","54e77e0a523b1b2f00e6f313","54e784affdabe62500fcddcf","54e784fa523b1b2f00e6f319","54e785de8ae8911900cd42c5","54fdad6e660db63700c23b82","54fdff31f7b1202100a25e06"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"createdAt":"2015-10-14T22:28:13.633Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"name":"CURL","code":"curl -k -X GET -H \"Cache-Control: no-cache\" 'https://api.gogeo.io/1.0/aggregations/MY_DATABASE/MY_COLLECTION/stats?mapkey=MY_MAP_KEY&field=NUMERIC_FIELD&group_by=GROUP_BY_FIELD&limit=3'","language":"shell"}]},"results":{"codes":[{"status":200,"language":"json","code":"[\n  {\n    \"key\": \"Group 1\",\n    \"count\": 29,\n    \"min\": 4814,\n    \"max\": 529710,\n    \"avg\": 84168.5172413793,\n    \"sum\": 2440887\n  },\n  {\n    \"key\": \"Group 2\",\n    \"count\": 25,\n    \"min\": 6472,\n    \"max\": 741096,\n    \"avg\": 126082.92,\n    \"sum\": 3152073\n  },\n  {\n    \"key\": \"Group 3\",\n    \"count\": 20,\n    \"min\": 3225,\n    \"max\": 1163414,\n    \"avg\": 99238.95,\n    \"sum\": 1984779\n  }\n]","name":""}]},"settings":"","auth":"never","params":[{"_id":"562a570926057f0d00a65adb","ref":"","in":"path","required":true,"desc":"Database name","default":"","type":"string","name":"database_name"},{"_id":"562a570926057f0d00a65ada","ref":"","in":"path","required":true,"desc":"Collection name","default":"","type":"string","name":"collection_name"},{"_id":"562a570926057f0d00a65ad9","ref":"","in":"query","required":true,"desc":"Your mapkey","default":"","type":"string","name":"mapkey"},{"_id":"561ed6fd0a04340d00d8a0b5","ref":"","in":"query","required":true,"desc":"Numeric field subject to aggregation","default":"","type":"string","name":"field"},{"_id":"561ed6fd0a04340d00d8a0b4","ref":"","in":"query","required":false,"desc":"Optional field to group by","default":"","type":"string","name":"group_by"},{"_id":"561ed6fd0a04340d00d8a0b3","ref":"","in":"query","required":false,"desc":"Optional elastic search query to filter data","default":"","type":"string","name":"q"},{"_id":"561ed6fd0a04340d00d8a0b2","ref":"","in":"query","required":false,"desc":"Optional geometry (GeoJSON) for spatial restriction","default":"","type":"string","name":"geom"},{"_id":"561ed6fd0a04340d00d8a0b1","ref":"","in":"query","required":false,"desc":"Limit of aggregations returned (max 500)","default":"100","type":"string","name":"limit"}],"url":"/aggregations/:database_name/:collection_name/stats"},"isReference":false,"order":43,"body":"","excerpt":"Computes metrics aggregations for numeric fields. Stats like **min**, **max**, **sum**, **count** and **avg** are returned. You can optionally group results by another field and also apply filters, spatial filter included.","slug":"stats-aggregation","type":"get","title":"Stats Aggregation"}

getStats Aggregation

Computes metrics aggregations for numeric fields. Stats like **min**, **max**, **sum**, **count** and **avg** are returned. You can optionally group results by another field and also apply filters, spatial filter included.

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Path Params

database_name:
required
string
Database name
collection_name:
required
string
Collection name

Query Params

mapkey:
required
string
Your mapkey
field:
required
string
Numeric field subject to aggregation
group_by:
string
Optional field to group by
q:
string
Optional elastic search query to filter data
geom:
string
Optional geometry (GeoJSON) for spatial restriction
limit:
string100
Limit of aggregations returned (max 500)

Examples


Result Format


User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}