2.X/4. Aggregations 38

4-04. Looking at Time

If search is the most popular activity in Elasticsearch, building date histograms must be the second most popular. Why would you want to use a date histogram?Elasticsearch에서 검색이 가장 인기 있는 요소라면, 두 번째는 date(날짜) histogram을 만드는 것이다. 왜 date histogram을 사용할까?Imagine your data has a timestamp. It doesn’t matter what the data is—Apache log events, stock buy/sell transaction dates, baseball game times—anyt..

2.X/4. Aggregations 2017.09.24

4-04-1. Returning Empty Buckets

Notice something odd about that last response?이전의 response가 뭔가 이상하지 않은가?Yep, that is right. We are missing a few months! By default, the date_histogram (and histogram too) returns only buckets that have a nonzero document count.그렇다. 빠져 있는 달이 있다. 기본적으로, date_histogram(histogram 도 마찬가지)은 document 수가 0 이 아닌 bucket만을 반환한다.This means your histogram will be a minimal response. Often, this is not the b..

2.X/4. Aggregations 2017.09.24

4-04-3. The Sky’s the Limit

These were obviously simple examples, but the sky really is the limit when it comes to charting aggregations. For example, Figure 39, “Kibana—aggregation을 가지고 만든 실시간 분석 dashboard”shows a dashboard in Kibana built with a variety of aggregations.이것들은 분명히 간단한 예제이지만, chart aggregation으로 하지 못할 것이 없다. 예를 들자면, Figure 39, “Kibana—aggregation을 가지고 만든 실시간 분석 dashboard”은, 다양한 aggregation을 가지고 만든, Kibana의 d..

2.X/4. Aggregations 2017.09.24

4-05. Scoping Aggregations

With all of the aggregation examples given so far, you may have noticed that we omitted a queryfrom the search request. The entire request was simply an aggregation.지금까지의 aggregation 예제에서는, 검색 request에서 query 가 생략되었다. 전체 request는 단순한 aggregation였다.Aggregations can be run at the same time as search requests, but you need to understand a new concept: scope. By default, aggregations operate in the ..

2.X/4. Aggregations 2017.09.24

4-06. Filtering Queries and Aggregations

A natural extension to aggregation scoping are filtering queries. Because the aggregation operates in the context of the query scope, any filter applied to the query will also apply to the aggregation.aggregation 범위 지정에 대한 자연스러운 확장은 filtering query이다. aggregation은 query의 범위 지정 문맥에서 동작하므로, query에 적용된 어떠한 filter도 aggregation에 적용될 수 있다.

2.X/4. Aggregations 2017.09.23

4-06-1. Filtering Queries

If we want to find all cars over $10,000 and also calculate the average price for those cars, we can use a constant_score query and its filter clause:$10,000 이상의 모든 자동차와 해당 자동차들의 평균가를 계산하려면, constant_score query와 filter절을 사용할 수 있다.GET /cars/transactions/_search { "size" : 0, "query" : { "constant_score": { "filter": { "range": { "price": { "gte": 10000 } } } } }, "aggs" : { "single_avg_price": {..

2.X/4. Aggregations 2017.09.23

4-06-2. Filter Bucket

But what if you would like to filter just the aggregation results? Imagine we are building the search page for our car dealership. We want to display search results according to what the user searches for. But we also want to enrich the page by including the average price of cars (matching the search) that were sold in the last month.하지만, aggregation 결과를 filtering하고 싶다면? 자동차 대리점을 위한, 검색 페이지를 구현한..

2.X/4. Aggregations 2017.09.23

4-06-3. Post Filter

So far, we have a way to filter both the search results and aggregations (a non-scoring filterquery), as well as filtering individual portions of the aggregation (filter bucket).이제, 검색 결과와 aggregation 양쪽 모두를 filtering(non-scoring filter query)하고, aggregation의 개별 부분을 filtering(filter bucket)하는 방법을 알게 되었다.You may be thinking to yourself, "hmm…is there a way to filter just the search results but no..

2.X/4. Aggregations 2017.09.23

4-06-4. Recap

Choosing the appropriate type of filtering—search hits, aggregations, or both—often boils down to how you want your user interface to behave. Choose the appropriate filter (or combinations) depending on how you want to display results to your user.filtering의 적절한 type(검색 hits, aggregation 또는 둘 모두)을 선택하는 것은, 사용자 인터페이스의 동작 방법이 핵심이다. 사용자에게 결과를 나타내는 방법에 따라, 적절한 filter나 조합을 선택하자.A non-scoring query in..

2.X/4. Aggregations 2017.09.23