다음을 통해 공유


top-hitters operator

Applies to: ✅Microsoft FabricAzure Data ExplorerAzure MonitorMicrosoft Sentinel

입력에서 가장 인기 있는 고유 값 또는 합계가 가장 큰 값에 대한 근사값을 반환합니다.

Note

top-hitters 는 입력 데이터가 큰 경우 성능에 최적화된 근사치 알고리즘을 사용합니다. The approximation is based on the Count-Min-Sketch algorithm.

Syntax

T|top-hittersNumberOfValuesofValueExpression [ bySummingExpression ]

Learn more about syntax conventions.

Parameters

Name Type Required Description
T string ✔️ 입력 테이블 형식 식입니다.
NumberOfValues int, long 또는 real ✔️ The number of distinct values of ValueExpression.
ValueExpression string ✔️ An expression over the input table T whose distinct values are returned.
SummingExpression string If specified, a numeric expression over the input table T whose sum per distinct value of ValueExpression establishes which values to emit. If not specified, the count of each distinct value of ValueExpression is used instead.

Note

  • When you include SummingExpression in the syntax, the query is equivalent to:

    T | summarize S = sum(SummingExpression) by ValueExpression | top NumberOfValues by S desc

  • When you don't include SummingExpression in the syntax, the query is equivalent to:

    T | summarize C = count() by ValueExpression | top NumberOfValues by C desc

Examples

이 섹션의 예제에서는 구문을 사용하여 시작하는 방법을 보여 줍니다.

The examples in this article use publicly available tables in the help cluster, such as the StormEvents table in the Samples database.

The examples in this article use publicly available tables, such as the Weather table in the Weather analytics sample gallery. 작업 영역의 테이블과 일치하도록 예제 쿼리에서 테이블 이름을 수정해야 할 수 있습니다.

합계별로 상위 2개 이벤트 가져오기

이 예제에서는 각 이벤트 유형에 대한 총 이벤트 수를 계산하여 Storm 이벤트 데이터를 요약합니다. 그런 다음 쿼리는 총 이벤트 수가 가장 많은 상위 두 이벤트 유형을 선택합니다.

StormEvents
| summarize TotalEventId = sum(EventId) by EventType
| top 2 by TotalEventId desc

Output

EventType TotalEventId
Thunderstorm Wind 562,509,013
Hail 474,690,007

가장 빈번한 항목 가져오기

이 예제에서는 상위 5가지 유형의 폭풍을 찾는 방법을 보여줍니다.

StormEvents
| top-hitters 5 of EventType 

Output

EventType approximate_count_EventType
Thunderstorm Wind 13015
Hail 12711
Flash Flood 3688
Drought 3616
Winter Weather 3349

열 값에 따라 상위 타자 가져오기

This example shows how to find the States with the most Thunderstorm Wind events.

StormEvents
| where EventType == "Thunderstorm Wind"
| top-hitters 10 of State 

Output

State approximate_sum_State
TEXAS 830
GEORGIA 609
MICHIGAN 602
IOWA 585
PENNSYLVANIA 549
ILLINOIS 533
NEW YORK 502
VIRGINIA 482
KANSAS 476
OHIO 455