Skip to content

Commit

Permalink
[ES|QL] Enhance the recommended queries with the event rate option (e…
Browse files Browse the repository at this point in the history
…lastic#196803)

## Summary

Adding another option to the recommended queries templates

<img width="1905" alt="image"
src="https://github.com/user-attachments/assets/e4def9bc-7d96-449f-a81f-c53d697ac38f">
  • Loading branch information
stratoula authored Oct 21, 2024
1 parent 498da89 commit 5eddb39
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,21 @@ export const getRecommendedQueries = ({
),
queryString: `${fromCommand}\n | WHERE ${timeField} <=?_tend and ${timeField} >?_tstart\n | STATS count = COUNT(*) BY \`Over time\` = BUCKET(${timeField}, 50, ?_tstart, ?_tend) // ?_tstart and ?_tend take the values of the time picker`,
},
{
label: i18n.translate(
'kbn-esql-validation-autocomplete.recommendedQueries.eventRate.label',
{
defaultMessage: 'Calculate the event rate',
}
),
description: i18n.translate(
'kbn-esql-validation-autocomplete.recommendedQueries.eventRate.description',
{
defaultMessage: 'Event rate over time',
}
),
queryString: `${fromCommand}\n | STATS count = COUNT(*), min_timestamp = MIN(${timeField}) // MIN(dateField) finds the earliest timestamp in the dataset.\n | EVAL event_rate = count / DATE_DIFF("seconds", min_timestamp, NOW()) // Calculates the event rate by dividing the total count of events by the time difference (in seconds) between the earliest event and the current time.\n | KEEP event_rate`,
},
{
label: i18n.translate(
'kbn-esql-validation-autocomplete.recommendedQueries.lastHour.label',
Expand Down

0 comments on commit 5eddb39

Please sign in to comment.