too_many_buckets_exception: Trying to create too many buckets
Elasticsearch의미
aggregation 쿼리가 허용 상한(search.max_buckets, 기본 65,536)보다 많은 bucket을 생성하려 했다. 메모리를 보호하기 위해 쿼리가 거부되었다.
원인
카디널리티가 높은 필드에서 매우 큰 size나 매우 세밀한 interval로 terms/date_histogram 같은 aggregation을 실행하거나, 중첩 aggregation이 bucket 수를 곱으로 늘리는 경우다. 과도한 bucket 생성은 노드 메모리를 고갈시킬 수 있으므로 한도가 적용된다.
해결 방법
생성되는 bucket 수를 줄인다: terms aggregation의 size를 낮추고, date_histogram interval을 넓히고, 불필요한 중첩 aggregation을 제거한다. 많은 결과가 필요하면 composite aggregation으로 페이지 단위로 조회한다. 한도를 높이는 것은 최후의 수단이며 메모리 위험이 따른다. search.max_buckets는 PUT _cluster/settings로 변경할 수 있지만 신중하게 한다.
같은 데이터베이스의 다른 항목
- node_not_connected_exceptionNode is not connected
- receive_timeout_transport_exceptionRequest timed out waiting for a response from another node (다른 노드의 응답 대기 중 요청 타임아웃)
- routing_missing_exceptionRouting value is required for this document (이 문서에는 routing 값이 필요)
- shard_lock_obtain_failed_exceptionObtaining shard lock timed out
- parsing_exceptionFailed to parse the search request / query DSL (검색 요청 / query DSL 파싱 실패)
- max_bytes_length_exceeded_exceptionDocument contains at least one immense term that is too long (너무 긴 거대한 term이 문서에 포함됨)
- illegal_argument_exception_total_fieldsLimit of total fields has been exceeded