window.first

Didukung di:
window.first(values_to_sort_by, values_to_return)

Deskripsi

Fungsi agregasi ini menampilkan nilai string yang berasal dari peristiwa dengan nilai int berkorelasi terendah di jendela pencocokan. Contoh kasus penggunaan adalah mendapatkan userid dari peristiwa dengan stempel waktu terendah di periode pencocokan (peristiwa paling awal).

Jenis data parameter

INT, STRING

Jenis hasil yang ditampilkan

STRING

Contoh kode

Mendapatkan nilai string yang berasal dari peristiwa dengan nilai int berkorelasi terendah di jendela pencocokan.

// 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.