Skip to content

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

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

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

Conversation

@kibanamachine
Copy link
Copy Markdown
Contributor

Backport

This will backport the following commits from main to 9.3:

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)
@doakalexi
Copy link
Copy Markdown
Contributor

/ci

@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Jan 15, 2026

⏳ Build in-progress, with failures

Failed CI Steps

Test Failures

  • [job] [logs] Scout: [ observability / profiling ] plugin / Admin user
  • [job] [logs] Scout: [ observability / profiling ] plugin / Admin user
  • [job] [logs] FTR Configs #17 / Endpoint plugin spaces support @ess @serverless @skipInServerlessMKI Endpoint management space awareness support "before all" hook in "@ess @serverless @skipInServerlessMKI Endpoint management space awareness support"
  • [job] [logs] FTR Configs #17 / Endpoint plugin spaces support @ess @serverless @skipInServerlessMKI Endpoint management space awareness support "before all" hook in "@ess @serverless @skipInServerlessMKI Endpoint management space awareness support"
  • [job] [logs] Scout: [ observability / profiling ] plugin / stateful - Profiling is setup and data is loaded - Admin user
  • [job] [logs] Scout: [ observability / profiling ] plugin / stateful - Profiling is setup and data is loaded - Admin user
  • [job] [logs] Scout: [ observability / profiling ] plugin / stateful - Profiling is setup and data is loaded - Viewer user
  • [job] [logs] Scout: [ observability / profiling ] plugin / stateful - Profiling is setup and data is loaded - Viewer user
  • [job] [logs] Scout: [ observability / profiling ] plugin / Viewer user
  • [job] [logs] Scout: [ observability / profiling ] plugin / Viewer user

History

cc @doakalexi

@kibanamachine kibanamachine merged commit 7d209d2 into elastic:9.3 Jan 15, 2026
13 checks passed
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants