Skip to content

[8.19] [Reporting] Fix timestamp override for ES|QL CSV scheduled reports with relative time ranges (#248169)#249051

Merged
kibanamachine merged 2 commits intoelastic:8.19from
kibanamachine:backport/8.19/pr-248169
Jan 15, 2026
Merged

[8.19] [Reporting] Fix timestamp override for ES|QL CSV scheduled reports with relative time ranges (#248169)#249051
kibanamachine merged 2 commits intoelastic:8.19from
kibanamachine:backport/8.19/pr-248169

Conversation

@kibanamachine
Copy link
Contributor

Backport

This will backport the following commits from main to 8.19:

Questions ?

Please refer to the Backport tool documentation

…th relative time ranges (elastic#248169)

Resolves elastic#245281

## Summary

This PR updates the code to generate ES|QL csv reports to use forceNow
for relative time ranges. To do this we added a new locator function to
get the `timeFieldName` from the job params bc the ES|QL time range
filters don't have the meta field populated.

### Checklist

Check the PR satisfies following conditions.

- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

### To verify

1. Create a data view on .kibana-event-log*
2. Use the query below in dev tools to create a scheduled report with a
hardcoded relative time range (You can adjust the timerange in the job
params to what you want when you're testing)
3. Verify that the eventual CSV report has data in the correct time
range

<details>
  <summary>
    <b>Query</b>
  </summary>

This scheduled report will run every minute 🙂

  ```
POST kbn:/internal/reporting/schedule/csv_v2
{
  "schedule": {
    "rrule": {
      "freq": 3,
      "interval": 1,
      "byhour": [
        0,
        1,
        2,
        3,
        4,
        5,
        6,
        7,
        8,
        9,
        10,
        11,
        12,
        13,
        14,
        15,
        16,
        17,
        18,
        19,
        20,
        21,
        22,
        23
      ],
      "byminute": [
        0,
        1,
        2,
        3,
        4,
        5,
        6,
        7,
        8,
        9,
        10,
        11,
        12,
        13,
        14,
        15,
        16,
        17,
        19,
        19,
        20,
        21,
        22,
        23,
        24,
        25,
        26,
        27,
        28,
        29,
        30,
        31,
        32,
        33,
        34,
        35,
        36,
        37,
        38,
        39,
        40,
        41,
        42,
        43,
        44,
        45,
        46,
        47,
        48,
        49,
        50,
        51,
        52,
        53,
        54,
        55,
        56,
        57,
        58,
        59
      ]
    }
  },
"jobParams":
"(browserTimezone:America/Los_Angeles,isEsqlMode:!t,locatorParams:!((id:DISCOVER_APP_LOCATOR,params:(columns:!(),dataViewSpec:(allowHidden:!f,allowNoIndex:!f,fieldFormats:(),id:'1a05eb41b8d4c4075bf8e71e472bc9855314219a15ddb77af59342159e67beb2',managed:!f,name:'.kibana-event-log*',runtimeFieldMap:(),sourceFilters:!(),timeFieldName:'@timestamp',title:'.kibana-event-log*',type:esql),filters:!(),hideChart:!t,interval:auto,query:(esql:'FROM
.kibana-event-log*'),refreshInterval:(pause:!t,value:60000),sort:!(),tab:(id:'203820a6-4f09-4b15-93c4-5d70924f3e52',label:Untitled),timeRange:(from:'2025-12-31T00:00:00.000Z',to:'2026-12-07T00:00:00.000Z')))),objectType:search,title:'Untitled
Discover session',version:'9.4.0')"
}
  ```
</details>

---------

Co-authored-by: Davis McPhee <davismcphee@hotmail.com>
(cherry picked from commit 75954f1)
@kibanamachine kibanamachine added the backport This PR is a backport of another PR label Jan 14, 2026
@kibanamachine kibanamachine enabled auto-merge (squash) January 14, 2026 15:31
@doakalexi
Copy link
Contributor

/ci

@kibanamachine kibanamachine merged commit 7931b19 into elastic:8.19 Jan 15, 2026
13 checks passed
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/generate-csv 28 30 +2
discover 162 164 +2
total +4
Unknown metric groups

API count

id before after diff
@kbn/generate-csv 28 30 +2
discover 211 213 +2
total +4

History

cc @doakalexi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR

3 participants