diff --git a/packages/kbn-esql-validation-autocomplete/src/autocomplete/recommended_queries/templates.ts b/packages/kbn-esql-validation-autocomplete/src/autocomplete/recommended_queries/templates.ts index f910d3ba05a3b..6a3226c9dcc8f 100644 --- a/packages/kbn-esql-validation-autocomplete/src/autocomplete/recommended_queries/templates.ts +++ b/packages/kbn-esql-validation-autocomplete/src/autocomplete/recommended_queries/templates.ts @@ -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',