--- title: "Query Analysis Group By Count" slug: "analytics-cloudsearch-analysisgroupbycount" updated: 2026-09-17T09:48:05Z published: 2026-09-17T09:48:05Z canonical: "api.ncloud-docs.com/analytics-cloudsearch-analysisgroupbycount" --- > ## Documentation Index > Fetch the complete documentation index at: https://api.ncloud-docs.com/llms.txt > Use this file to discover all available pages before exploring further. # Query Analysis Group By Count **We are preparing a localization service for the content. We will do our best to provide the localization service as soon as possible.** Analyze the search queries used and aggregate the count by field. - city1: city classification field1 ex) Seoul, Gyeonggi-do, Chungcheongbuk-do - city2: city classification field2 ex) Gangnam-gu, Seocho, Guro-gu - city3: city classification field2 ex) Yeoksam-dong, Jeongja-dong, Seocho-dong - country: country - word: word that stemmed from the search Query ``` POST https://cloudsearch.apigw.ntruss.com/CloudSearch/real/v1/domain/{name}/analysis/count_group_by ``` ## Request ### Request parameter | Parameter Name | Required | Type | Restrictions | Description | | --- | --- | --- | --- | --- | | name | Yes | string | | The name of the created domain | ### Request body | Field Name | Required | Type | Restrictions | Description | | --- | --- | --- | --- | --- | | from | Yes | string | | Start time (UTC, ex: 20161027T171340Z) | | to | Yes | string | | End time (UTC, ex: 20161027T171340Z) | | groupBy | Yes | [QueryAnalysisField](/docs/en/common-apidatatype-csanalysisfieldenum) | | groupBy configuration | | aggregate | Yes | [AggregateSchema](/docs/en/common-apidatatype-csanalysisaggregatebyschema) | | aggregate configuration | ## Response | Field Name | Type | Description | Remarks | | --- | --- | --- | --- | | key | string | The base value of the grouped result | | | doc_count | number | Sum of all values corresponding to base value | | | aggregated_result.sum_other_doc_count | number | When the aggregate result is greater than the specified max_size value, the sum of all the values not printed in the result | | | aggregated_result.buckets [] | array | Grouping by key of aggreagte result | | | aggregated_result.buckets []. key | string | The value of the field used in the query during that time | | | aggregated_result.buckets []. doc_count | string | The number of keys used in the query during that time | | ### Response Status | Http Status | Desc | | --- | --- | | 200 | OK | | 200 | status.code : -1(request fail) | | 400 | Bad Request | | 401 | Unauthorized | | 401 | there is no such service | | 403 | Forbidden | | 404 | Not Found | | 500 | Internal Server Error | ## Example ### Example Request1 : In case 'field_value' is available ``` POST https://cloudsearch.apigw.ntruss.com/CloudSearch/real/v1/domain/car_dev/analysis/count_group_by POST /CloudSearch/real/v1/domain/car_dev/analysis/count_group_by HTTP/1.1 Host:cloudsearch.apigw.ntruss.com accept:application/json x-ncp-apigw-signature-v2: cDwtHuQeGmwWyNmwlN6XIGA66zge4iMXvfoDQNna05g= x-ncp-apigw-timestamp: 1545817618751 x-ncp-iam-access-key: teGTwtcSEGA7fu28BGGi { "from": "2019-09-25T05:00:00Z", "to": "2019-09-25T15:00:00Z", "groupBy": { "field": "word", "field_value": "현대", "max_size": 10 }, "aggregate": { "field": "city1", "max_size": 10 } } ``` ### Example response ``` [ { "key": "현대", "doc_count": 1, "aggregated_result": { "sum_other_doc_count": 0, "buckets": [ { "key": "경기도", "doc_count": 1 } ] } } ] ``` ### Example Request2 : In case 'field_value' is not available ``` POST https://cloudsearch.apigw.ntruss.com/CloudSearch/real/v1/domain/car_dev/analysis/count_group_by POST /CloudSearch/real/v1/domain/car_dev/analysis/count_group_by HTTP/1.1 Host:cloudsearch.apigw.ntruss.com accept:application/json x-ncp-apigw-signature-v2: cDwtHuQeGmwWyNmwlN6XIGA66zge4iMXvfoDQNna05g= x-ncp-apigw-timestamp: 1545817618751 x-ncp-iam-access-key: teGTwtcSEGA7fu28BGGi { "from": "2019-09-25T05:00:00Z", "to": "2019-09-25T15:00:00Z", "groupBy": { "field": "word", "maxSize": 10 }, "aggregate": { "field": "city1", "maxSize": 10 } } ``` ### Example response ``` [ { "key": "class", "doc_count": 3117, "aggregated_result": { "sum_other_doc_count": 357, "buckets": [ { "key": "서울특별시", "doc_count": 1378 }, { "key": "경기도", "doc_count": 473 }, { "key": "", "doc_count": 300 }, { "key": "인천광역시", "doc_count": 119 }, { "key": "대구광역시", "doc_count": 107 }, { "key": "부산광역시", "doc_count": 104 }, { "key": "경상북도", "doc_count": 83 }, { "key": "전라북도", "doc_count": 69 }, { "key": "대전광역시", "doc_count": 64 }, { "key": "경상남도", "doc_count": 63 } ] } }, { "key": "bmw", "doc_count": 3027, "aggregated_result": { "sum_other_doc_count": 303, "buckets": [ { "key": "서울특별시", "doc_count": 1295 }, { "key": "경기도", "doc_count": 515 }, { "key": "", "doc_count": 331 }, { "key": "인천광역시", "doc_count": 127 }, { "key": "대구광역시", "doc_count": 105 }, { "key": "부산광역시", "doc_count": 88 }, { "key": "경상북도", "doc_count": 79 }, { "key": "대전광역시", "doc_count": 63 }, { "key": "전라북도", "doc_count": 63 }, { "key": "전라남도", "doc_count": 58 } ] } } ] ```