window.first
以下でサポートされています。
window.first(values_to_sort_by, values_to_return)
説明
この集計関数は、一致ウィンドウ内で最も相関性の高い整数値を持つイベントから派生した文字列値を返します。たとえば、一致ウィンドウ内でタイムスタンプが最も低いイベント(最も早いイベント)からユーザー ID を取得するといったユースケースがあります。
パラメータのデータ型
INT
、STRING
戻り値の型
STRING
コードサンプル
一致ウィンドウ内で相関関係のある整数値が最も低いイベントから派生した文字列値を取得します。
// This rule sets the outcome $first_event to the lowest correlated int value
// in the 5 minute match window.
events:
$e.user.userid = $userid
match:
$userid over 5m
outcome:
$first_event = window.first($e.metadata.timestamp.seconds, $e.metadata.event_type) // yields v1 if the events in the match window are 1, 2 and 3 and corresponding values v1, v2, and v3.