본문 바로가기

aggs4

Elasticsearch Aggregations#4 Sub Aggregations Aggregations을 수행할 때 사용할 데이터 Sub Aggregations aggregation을 통해 집계를 내고 그 결과에서 세부적인 집계를 위해 Sub Aggregation을 지원하고 있습니다. level 필드별 duration의 평균 시간 구하기 우리는 데이터를 가져오는 것이 목적이 아닌 Aggregations을 수행하는 것이 목적이기 때문에 "size"를 0으로 설정하였습니다. api POST http://localhost:9200/test-log-index-2021-09-12/_search header content-type: application/json body { "size": 0, "query": { "match_all": {} }, "aggs": { "byLevel": { "te.. 2021. 9. 19.
Elasticsearch Aggregations#3 terms, ranges, histogram, date_range Aggregation을 수행할 때 사용할 데이터 terms terms는 데이터의 keyword별 종류 및 개수를 집계하는데 사용합니다. 모든 도큐먼트의 level의 종류와 개수 구하기 우리는 데이터를 가져오는 것이 목적이 아닌 Aggregation을 수행하는 것이 목적이기 때문에 "size"를 0으로 설정하였습니다. level 필드의 데이터 종류와 각 종류별로 도큐먼트가 몇개 있는지 확인합니다. api POST http://localhost:9200/test-log-index-2021-09-12/_search header content-type: application/json body { "size": 0, "query": { "match_all": {} }, "aggs": { "byLevel": { ".. 2021. 9. 17.
Elasticsearch Aggregations#2 cardinality, percentiles, percentile_ranks Aggregation을 수행할 때 사용할 데이터 cardinality cardinality는 데이터의 종류가 몇 가지 있는지 확인하는 데 사용됩니다. user_id가 1인 도큐먼트에 action이 몇가지 종류가 있는지 확인하기 우리는 데이터를 가져오는 것이 목적이 아닌 Aggregations을 수행하는 것이 목적이기 때문에 "size"를 0으로 설정하였습니다. api POST http://localhost:9200/test-log-index-2021-09-12/_search header content-type: application/json body { "size": 0, "query": { "bool": { "must": [ { "match": { "user_id": "1" } } ] } }, "agg.. 2021. 9. 15.
Elasticsearch Aggregations#1 min, max, sum, avg, stats Aggregation을 수행할 때 사용할 데이터 Aggregations이란 저장된 데이터를 수치화시키는 여러 가지의 연산을 수행하는 역할을 합니다. 이러한 기능을 통하여 데이터를 분석하여 사용자가 보기 좋게 시각화를 할 수 있습니다. 이번 페이지에서는 min, max, sum, avg, stats에 대하여 알아보겠습니다. min query의 검색 결과에 특정 필드의 값이 가장 작은 값을 나타냅니다. user_id가 1인 도큐먼트의 duration 필드의 최솟값 구하기 "size"를 0으로 설정한 이유는 우리는 데이터를 가져오는 것이 목적이 아닌 user_id가 1인 도큐먼트에서 duration이 가장 작은 값만 도출하는 것이 목적이기 때문에 불필요하게 데이터를 가져오는 것을 생략하기 위함입니다. "agg.. 2021. 9. 13.