{"_id":"5797a1786b0a1b19006dec94","user":"56267741db1eda0d001c3dbb","project":"55faeacad0e22017005b8265","parentDoc":null,"category":{"_id":"56e1ccc4e416450e00b9e48c","project":"55faeacad0e22017005b8265","version":"55faeacad0e22017005b8268","pages":["56e1cdd892bf640e00b5564b","56e1cdfde416450e00b9e490","56e1ce4892bf640e00b5564e","56e1ce81e416450e00b9e494","56e1ceebe416450e00b9e497","56e1cf39cd6a8d0e00d12176","56e30b4b51857d0e008e77a3","56e30bd26e602e0e00700b16","56e30dd0d46bc30e007bb986","56e30e3d872bb20e0051ba39","56e30f91cb6ef20e0084f23c"],"__v":11,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-03-10T19:36:36.026Z","from_sync":false,"order":17,"slug":"aggregations-facets-vector-services-guide","title":"Aggregations & Facets Vector Services Guide"},"version":{"_id":"55faeacad0e22017005b8268","project":"55faeacad0e22017005b8265","__v":35,"createdAt":"2015-09-17T16:31:06.800Z","releaseDate":"2015-09-17T16:31:06.800Z","categories":["55faeacbd0e22017005b8269","55faf550764f50210095078e","55faf5b5626c341700fd9e96","55faf8a7825d5f19001fa386","560052f91503430d007cc88f","560054f73aa0520d00da0b1a","56005aaf6932a00d00ba7c62","56005c273aa0520d00da0b3f","5601ae7681a9670d006d164d","5601ae926811d00d00ceb487","5601aeb064866b1900f4768d","5601aee850ee460d0002224c","5601afa02499c119000faf19","5601afd381a9670d006d1652","561d4c78281aec0d00eb27b6","561d588d8ca8b90d00210219","563a5f934cc3621900ac278c","5665c5763889610d0008a29e","566710a36819320d000c2e93","56ddf6df8a5ae10e008e3926","56e1c96b2506700e00de6e83","56e1ccc4e416450e00b9e48c","56e1ccdfe63f910e00e59870","56e1cd10bc46be0e002af26a","56e1cd21e416450e00b9e48e","56e3139a51857d0e008e77be","573b4f62ef164e2900a2b881","57c9d1335fd8ca0e006308ed","57e2bd9d1e7b7220000d7fa5","57f2b992ac30911900c7c2b6","58adb5c275df0f1b001ed59b","58c81b5c6dc7140f003c3c46","595412446ed4d9001b3e7b37","59e76ce41938310028037295","5a009de510890d001c2aabfe"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"v1","version_clean":"1.0.0","version":"1"},"__v":1,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-07-26T17:44:24.779Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"code":"Request:\n  POST /insight-vector/api/aggregation?aggs=:aggs&query=:query&startDate=:startDate&endDate=:endDate&count=:count\n\nHeaders:\n  Authorization: Bearer {token}\n  Content-Type: application/json\n\nBody:\n  {...geoJSON geometrycollection...}\n  \n\nResponse (success):\n  200 OK","language":"text"},{"code":"https://vector.geobigdata.io/insight-vector/api/aggregation?aggs=geohash:3;terms:ingest_source&count=5\n\nBody:\n{\"type\":\"GeometryCollection\",\"geometries\":[{\"type\": \"MultiPolygon\",\"coordinates\": [[[[-109.0283203125,36.98500309285596],[-109.0283203125,40.97989806962013],[-102.06298828125,40.97989806962013],[-102.06298828125,37.00255267215955],[-109.0283203125,36.98500309285596]]]]}]}","language":"http"}]},"method":"post","results":{"codes":[{"code":"{\n  \"responseDate\": \"2016-07-26T17:49:11Z\",\n  \"geom\": {\n    \"coordinates\": [\n      [\n        [\n          [\n            -109.0283203125,\n            36.98500309285596\n          ],\n          [\n            -109.0283203125,\n            40.97989806962013\n          ],\n          [\n            -102.06298828125,\n            40.97989806962013\n          ],\n          [\n            -102.06298828125,\n            37.00255267215955\n          ],\n          [\n            -109.0283203125,\n            36.98500309285596\n          ]\n        ]\n      ]\n    ],\n    \"type\": \"MultiPolygon\"\n  },\n  \"query\": null,\n  \"startDate\": null,\n  \"endDate\": null,\n  \"totalItems\": 3358432,\n  \"aggregations\": [\n    {\n      \"name\": \"geohash:3\",\n      \"terms\": [\n        {\n          \"term\": \"9xj\",\n          \"count\": 1985501,\n          \"aggregations\": [\n            {\n              \"name\": \"terms:ingest_source\",\n              \"terms\": [\n                {\n                  \"term\": \"Maps API\",\n                  \"count\": 641063,\n                  \"aggregations\": null\n                },\n                {\n                  \"term\": \"OSM\",\n                  \"count\": 535113,\n                  \"aggregations\": null\n                },\n                {\n                  \"term\": \"IDAHOTest\",\n                  \"count\": 481535,\n                  \"aggregations\": null\n                },\n                {\n                  \"term\": \"Twitter\",\n                  \"count\": 265067,\n                  \"aggregations\": null\n                },\n                {\n                  \"term\": \"GDELT\",\n                  \"count\": 43876,\n                  \"aggregations\": null\n                }\n              ]\n            }\n          ]\n        },\n        ...\n      ]\n    }\n  ]\n}","language":"json","status":200,"name":""}]},"settings":"56e2c51cc8b0a40e000aa56b","auth":"required","params":[{"_id":"56e30dd0d46bc30e007bb98f","ref":"","in":"query","required":true,"desc":"The aggregation definitions.","default":"geohash:4;date_hist:d;terms:ingest_source","type":"string","name":"aggs"},{"_id":"56e30dd0d46bc30e007bb98e","ref":"","in":"query","required":false,"desc":"The Elasticsearch query string to constrain the document set.","default":"item_type:tweet","type":"string","name":"query"},{"_id":"56e30dd0d46bc30e007bb989","ref":"","in":"query","required":false,"desc":"ISO-8601-formatted or \"now\" expression formatted date string for the start of a date range; startDate runs a query against the field item_date. Note: For more information on the syntax, check the [Query Syntax](vector-query-syntax-query-fields-and-type-suffixes) page. If no date range is provided, then all items within the AOI will be included.","default":"2015-09-03T12:07:16.179Z","type":"string","name":"startDate"},{"_id":"56e30dd0d46bc30e007bb988","ref":"","in":"query","required":false,"desc":"ISO-8601-formatted or \"now\" expression formatted date string for the end of a date range; endDate runs a query against the field item_date. Note: For more information on the syntax, check the [Query Syntax](vector-query-syntax-query-fields-and-type-suffixes) page. If no date range is provided, then all items within the AOI will be included. The date range is inclusive at both ends.","default":"2015-09-03T12:52:33.208Z","type":"string","name":"endDate"},{"_id":"56e30dd0d46bc30e007bb987","ref":"","in":"query","required":false,"desc":"The number of buckets to return per aggregation.","default":"10","type":"int","name":"count"}],"url":"/insight-vector/api/aggregation?"},"isReference":false,"order":7,"body":"For more information on aggregations parameters and definitions, check the [Aggregations Overview](doc:vector-services-aggregations-reference-overview).\n\nFor examples of how to form an aggregation query, check the [Aggregation Example Query Constructions](doc:vector-services-example-query-constructions#section-aggregations-with-shape).","excerpt":"Groups vector items based on the given polygon and aggregation definition.","slug":"aggs-shape-query","type":"endpoint","title":"Aggregation (arbitrary geometry)"}

postAggregation (arbitrary geometry)

Groups vector items based on the given polygon and aggregation definition.

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Query Params

aggs:
required
stringgeohash:4;date_hist:d;terms:ingest_source
The aggregation definitions.
query:
stringitem_type:tweet
The Elasticsearch query string to constrain the document set.
startDate:
string2015-09-03T12:07:16.179Z
ISO-8601-formatted or "now" expression formatted date string for the start of a date range; startDate runs a query against the field item_date. Note: For more information on the syntax, check the [Query Syntax](vector-query-syntax-query-fields-and-type-suffixes) page. If no date range is provided, then all items within the AOI will be included.
endDate:
string2015-09-03T12:52:33.208Z
ISO-8601-formatted or "now" expression formatted date string for the end of a date range; endDate runs a query against the field item_date. Note: For more information on the syntax, check the [Query Syntax](vector-query-syntax-query-fields-and-type-suffixes) page. If no date range is provided, then all items within the AOI will be included. The date range is inclusive at both ends.
count:
integer10
The number of buckets to return per aggregation.

Examples


Result Format


Documentation

For more information on aggregations parameters and definitions, check the [Aggregations Overview](doc:vector-services-aggregations-reference-overview). For examples of how to form an aggregation query, check the [Aggregation Example Query Constructions](doc:vector-services-example-query-constructions#section-aggregations-with-shape).

User Information

Try It Out


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