2.X/4. Aggregations 38

4. Aggregations

Until this point, this book has been dedicated to search. With search, we have a query and we want to find a subset of documents that match the query. We are looking for the proverbial needle(s) in the haystack.지금까지, 이 책에서는 검색에 집중하였다. 검색과 함께, 어떤 query를 가지고, 그 query에 일치하는 document의 집합을 찾으려 했다. 속담처럼, 건초더미에서 바늘 찾기를 하고 있다.With aggregations, we zoom out to get an overview of our data. Instead of look..

2.X/4. Aggregations 2017.09.24

4-01. High-Level Concepts

Like the query DSL, aggregations have a composable syntax: independent units of functionality can be mixed and matched to provide the custom behavior that you need. This means that there are only a few basic concepts to learn, but nearly limitless combinations of those basic components.query DSL과 마찬가지로, aggregation은 구성이 가능한 문법을 가지고 있다. 필요한 사용자 정의 동작을 제공하기 위해, 독립적인 기능 단위를 혼합하고 일치될 수 있다. 즉, 배워야 할 ..

2.X/4. Aggregations 2017.09.24

4-01-1. Buckets

A bucket is simply a collection of documents that meet certain criteria:bucket 은 어떤 기준을 만족시키는 document의 단순한 집합이다An employee would land in either the male or female bucket.종업원은 남성(male) 이나 여성(female) bucket에 포함된다.The city of Albany would land in the New York state bucket.올버니(Albany)는 뉴욕(New York) 주 bucket에 포함된다.The date 2014-10-28 would land within the October bucket."2014-10-28" 이란 날짜는 10월(Octob..

2.X/4. Aggregations 2017.09.24

4-01-2. Metrics

Buckets allow us to partition documents into useful subsets, but ultimately what we want is some kind of metric calculated on those documents in each bucket. Bucketing is the means to an end: it provides a way to group documents in a way that you can calculate interesting metrics.bucket은 document를 유용한 부분집합으로 분류한다. 그러나, 궁극적인 목표는, 각 bucket에 있는 해당 document에서 계산된, 어떤 종류의 metric이다. bucket으로 분류하는 것은 어..

2.X/4. Aggregations 2017.09.24

4-02. Aggregation Test-Drive

We could spend the next few pages defining the various aggregations and their syntax, but aggregations are truly best learned by example. Once you learn how to think about aggregations, and how to nest them appropriately, the syntax is fairly trivial.다음 몇 페이지에서, 다양한 aggregation과 그 문법에 대해 이야기할 것이다. 그러나, aggregation은 예제로 배우는 것이 제일 좋다. aggregation에 대해 생각하는 방법과, 적절하게 중첩시키는 방법을 배우기만 하면, 문법은 매우 간단하다.A..

2.X/4. Aggregations 2017.09.24

4-02-1. Adding a Metric to the Mix

The previous example told us the number of documents in each bucket, which is useful. But often, our applications require more-sophisticated metrics about the documents. For example, what is the average price of cars in each bucket?위의 예제에서, 각 bucket의 document 수를 알 수 있었다. 이것은 유용하다. 하지만, 응용프로그램에서는 document에 대한 더 복잡한 metric을 요구한다. 예를 들자면, 각 bucket의 자동차 평균 가격은?To get this information, we need to tel..

2.X/4. Aggregations 2017.09.24

4-02-2. Buckets Inside Buckets

The true power of aggregations becomes apparent once you start playing with different nesting schemes. In the previous examples, we saw how you could nest a metric inside a bucket, which is already quite powerful.또 다른 중첩 방식을 적용해 보면, aggregation의 진정한 위력은 분명해진다. 이전의 예제에서, bucket 내부에 metric을 중첩하는 방법을 알 수 있었다. 그것으로 이미 매우 강력하다.But the real exciting analytics come from nesting buckets inside other buc..

2.X/4. Aggregations 2017.09.24

4-02-3. One Final Modification

Just to drive the point home, let’s make one final modification to our example before moving on to new topics. Let’s add two metrics to calculate the min and max price for each make:논점을 바꿔서, 새로운 주제로 가기 전에, 예제를 마지막으로 수정해 보자. 제조사 별로 최소, 최대 가격을 계산하는 2개의 metric을 추가해 보자.GET /cars/transactions/_search { "size" : 0, "aggs": { "colors": { "terms": { "field": "color" }, "aggs": { "avg_price": { "avg": { ..

2.X/4. Aggregations 2017.09.24

4-03. Building Bar Charts

One of the exciting aspects of aggregations are how easily they are converted into charts and graphs. In this chapter, we are focusing on various analytics that we can wring out of our example dataset. We will also demonstrate the types of charts aggregations can power.aggregation의 가장 흥미로운 부분 중 하나는, 그것을 chart와 graph로 변경하기가 쉽다는 것이다. 이 장에서, 예제 데이터 집합에서 뽑아낼 수 있는 다양한 분석에 집중할 것이다. 또한 aggregation에서 가능..

2.X/4. Aggregations 2017.09.24