Is there any way to implement SQL window functions?
Here is my use case:
Multiple events reported with "Type" and "Timestamp" fields. I'm looking for a way to extract the latest occurrence of each type.
In SQL this can be easily achieved:
This is how my data looks like:
..and this is the desired output:
The following query achieves just that:
SELECT [Type],[Description] FROM (
ROW_NUMBER() OVER (PARTITION BY [Type] ORDER BY [Timestamp] DESC) AS [RowNumber],
WHERE T.[RowNumber] = 1
Yeah, I know Elastic is not a relational database. However, I was hoping this is feasible and I'm just unable to find out how...