4-07-1. Intrinsic Sorts
These sort modes are intrinsic to the bucket: they operate on data that bucket generates, such as doc_count
. They share the same syntax but differ slightly depending on the bucket being used.
이 정렬 방식은 bucket의 기본 이다. doc_count 처럼, bucket이 생성한 데이터에 따라 동작한다. 동일한 문법을 공유하지만, 사용된 bucket에 따라 약간 다르다.
Let’s perform a terms
aggregation but sort by doc_count
, in ascending order:
terms
aggregation을 해보자. 그러나 doc_count
를 기준으로, 오름차순으로 정렬하자.
GET /cars/transactions/_search { "size" : 0, "aggs" : { "colors" : { "terms" : { "field" : "color", "order": { "_count" : "asc"} } } } }
We introduce an order
object into the aggregation, which allows us to sort on one of several values:
aggregation에서 order
오브젝트를 소개한다. 이것을 이용하여, 아래의 여러 가지 값 중 하나를 기준으로, 정렬할 수 있다.
_count
Sort by document count. Works with
terms
,histogram
,date_histogram
.document 수로 정렬.
terms
,histogram
,date_histogram
과 함께 동작_term
Sort by the string value of a term alphabetically. Works only with
terms
.단어의 문자열 값을 알파벳 순으로 정렬.
terms
의 경우에만 동작_key
Sort by the numeric value of each bucket’s key (conceptually similar to
_term
). Works only withhistogram
anddate_histogram
.각 bucket의 key(개념적으로
_term
과 유사)의 숫자 값으로 정렬.histogram
,date_histogram
의 경우에만 동작