Skip to content

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

Merged
doakalexi merged 8 commits intoelastic:mainfrom
doakalexi:reporting/245281
Jan 14, 2026
Merged

[Reporting] Fix timestamp override for ES|QL CSV scheduled reports with relative time ranges#248169
doakalexi merged 8 commits intoelastic:mainfrom
doakalexi:reporting/245281

Conversation

@doakalexi
Copy link
Contributor

@doakalexi doakalexi commented Jan 7, 2026

Resolves #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.

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
Query

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')"
}
@doakalexi doakalexi changed the title Updating ES|QL csv reports to update for relative time range Jan 7, 2026
@doakalexi doakalexi added bug Fixes for quality problems that affect the customer experience Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t// backport:version Backport to applied version labels v9.3.0 v9.4.0 v9.2.4 v9.1.10 v8.19.10 labels Jan 7, 2026
@doakalexi doakalexi marked this pull request as ready for review January 8, 2026 15:48
@doakalexi doakalexi requested review from a team as code owners January 8, 2026 15:48
@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

Copy link
Contributor

@pmuellr pmuellr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

const timeFieldNameFromLocator = async (
params: DiscoverAppLocatorParams
): Promise<string | undefined> => {
if (params.dataViewSpec && params.dataViewSpec.timeFieldName) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we change this to return params.dataViewSpec?.timeFieldName; ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah! Updated in this commit, ed06b25

@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

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 29 31 +2
discover 159 161 +2
total +4
Unknown metric groups

API count

id before after diff
@kbn/generate-csv 29 31 +2
discover 202 204 +2
total +4

History

Copy link
Contributor

@davismcphee davismcphee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code-only review, Data Discovery changes LGTM, although it wasn't clear to me how to test from the PR or linked issue. The PR mentions relative time ranges, but the example request seems to use an absolute time range.

Comment on lines 23 to 25
if (params.dataViewSpec && params.dataViewSpec.timeFieldName) {
return params.dataViewSpec?.timeFieldName;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (params.dataViewSpec && params.dataViewSpec.timeFieldName) {
return params.dataViewSpec?.timeFieldName;
}
return params.dataViewSpec?.timeFieldName;

I think the original suggestion was probably to drop the if statement entirely in favour of optional chaining, which makes sense because shouldn't need both.

On a separate note, I have some reservations about relying on dataViewSpec for ES|QL reports, but I see we already do it for other properties and don't currently have an alternative to suggest. Just feels like it shouldn't be necessary for ES|QL in general.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh okay, that's my bad. I misunderstood Patrick's comment

Sorry for not being clear, sometimes when they user specifies a relative time range it get's saved as an absolute time range. We received an SDH about it and I can replicate this in 8.19, but in main rn I can't get it to save as the absolute time range. In the verification steps I provide a scheduled report that forces it to be an absolute time range, so you can verify that the code overrides the time range.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, and thanks for explaining! I understand better now and think we're good to merge this.

FWIW the SDH bug sounds like this one: #223171. We merged a fix for it in #223249 (8.19 backport in #223346), but it was overwritten by a separate backport and missed the 8.19 release. We then merged a separate fix for it to 8.19.7 in #241931. So users who encounter it in earlier versions of 8.19 will need to upgrade to 8.19.7+ to fix it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh nice, thanks!

doakalexi and others added 2 commits January 13, 2026 09:16
@doakalexi doakalexi merged commit 75954f1 into elastic:main Jan 14, 2026
13 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.19, 9.1, 9.2, 9.3

https://github.com/elastic/kibana/actions/runs/20999463337

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jan 14, 2026
…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 pushed a commit to kibanamachine/kibana that referenced this pull request Jan 14, 2026
…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 pushed a commit to kibanamachine/kibana that referenced this pull request Jan 14, 2026
…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 pushed a commit to kibanamachine/kibana that referenced this pull request Jan 14, 2026
…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
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.19
9.1
9.2
9.3

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Jan 14, 2026
…rts with relative time ranges (#248169) (#249052)

# Backport

This will backport the following commits from `main` to `9.1`:
- [[Reporting] Fix timestamp override for ES|QL CSV scheduled reports
with relative time ranges
(#248169)](#248169)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Alexi
Doak","email":"109488926+doakalexi@users.noreply.github.com"},"sourceCommit":{"committedDate":"2026-01-14T15:22:08Z","message":"[Reporting]
Fix timestamp override for ES|QL CSV scheduled reports with relative
time ranges (#248169)\n\nResolves
https://github.com/elastic/kibana/issues/245281\n\n## Summary\n\nThis PR
updates the code to generate ES|QL csv reports to use forceNow\nfor
relative time ranges. To do this we added a new locator function to\nget
the `timeFieldName` from the job params bc the ES|QL time range\nfilters
don't have the meta field populated.\n\n\n### Checklist\n\nCheck the PR
satisfies following conditions. \n\n- [ ] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n\n\n### To
verify\n\n1. Create a data view on .kibana-event-log*\n2. Use the query
below in dev tools to create a scheduled report with a\nhardcoded
relative time range (You can adjust the timerange in the job\nparams to
what you want when you're testing)\n3. Verify that the eventual CSV
report has data in the correct time\nrange\n\n<details>\n <summary> \n
<b>Query</b>\n </summary> \n\nThis scheduled report will run every
minute 🙂 \n\n ```\nPOST kbn:/internal/reporting/schedule/csv_v2\n{\n
\"schedule\": {\n \"rrule\": {\n \"freq\": 3,\n \"interval\": 1,\n
\"byhour\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n
11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n
23\n ],\n \"byminute\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n
9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 19,\n 19,\n 20,\n
21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n
33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n
45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n
57,\n 58,\n 59\n ]\n }\n
},\n\"jobParams\":\n\"(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\n.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\nDiscover
session',version:'9.4.0')\"\n}\n
```\n</details>\n\n---------\n\nCo-authored-by: Davis McPhee
<davismcphee@hotmail.com>","sha":"75954f185f2a2befc2113b2d0b3d4c32a87bdb6f","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Team:ResponseOps","backport:version","v9.3.0","v9.4.0","v9.2.4","v9.1.10","v8.19.10"],"title":"[Reporting]
Fix timestamp override for ES|QL CSV scheduled reports with relative
time
ranges","number":248169,"url":"https://github.com/elastic/kibana/pull/248169","mergeCommit":{"message":"[Reporting]
Fix timestamp override for ES|QL CSV scheduled reports with relative
time ranges (#248169)\n\nResolves
https://github.com/elastic/kibana/issues/245281\n\n## Summary\n\nThis PR
updates the code to generate ES|QL csv reports to use forceNow\nfor
relative time ranges. To do this we added a new locator function to\nget
the `timeFieldName` from the job params bc the ES|QL time range\nfilters
don't have the meta field populated.\n\n\n### Checklist\n\nCheck the PR
satisfies following conditions. \n\n- [ ] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n\n\n### To
verify\n\n1. Create a data view on .kibana-event-log*\n2. Use the query
below in dev tools to create a scheduled report with a\nhardcoded
relative time range (You can adjust the timerange in the job\nparams to
what you want when you're testing)\n3. Verify that the eventual CSV
report has data in the correct time\nrange\n\n<details>\n <summary> \n
<b>Query</b>\n </summary> \n\nThis scheduled report will run every
minute 🙂 \n\n ```\nPOST kbn:/internal/reporting/schedule/csv_v2\n{\n
\"schedule\": {\n \"rrule\": {\n \"freq\": 3,\n \"interval\": 1,\n
\"byhour\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n
11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n
23\n ],\n \"byminute\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n
9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 19,\n 19,\n 20,\n
21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n
33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n
45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n
57,\n 58,\n 59\n ]\n }\n
},\n\"jobParams\":\n\"(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\n.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\nDiscover
session',version:'9.4.0')\"\n}\n
```\n</details>\n\n---------\n\nCo-authored-by: Davis McPhee
<davismcphee@hotmail.com>","sha":"75954f185f2a2befc2113b2d0b3d4c32a87bdb6f"}},"sourceBranch":"main","suggestedTargetBranches":["9.3","9.2","9.1","8.19"],"targetPullRequestStates":[{"branch":"9.3","label":"v9.3.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/248169","number":248169,"mergeCommit":{"message":"[Reporting]
Fix timestamp override for ES|QL CSV scheduled reports with relative
time ranges (#248169)\n\nResolves
https://github.com/elastic/kibana/issues/245281\n\n## Summary\n\nThis PR
updates the code to generate ES|QL csv reports to use forceNow\nfor
relative time ranges. To do this we added a new locator function to\nget
the `timeFieldName` from the job params bc the ES|QL time range\nfilters
don't have the meta field populated.\n\n\n### Checklist\n\nCheck the PR
satisfies following conditions. \n\n- [ ] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n\n\n### To
verify\n\n1. Create a data view on .kibana-event-log*\n2. Use the query
below in dev tools to create a scheduled report with a\nhardcoded
relative time range (You can adjust the timerange in the job\nparams to
what you want when you're testing)\n3. Verify that the eventual CSV
report has data in the correct time\nrange\n\n<details>\n <summary> \n
<b>Query</b>\n </summary> \n\nThis scheduled report will run every
minute 🙂 \n\n ```\nPOST kbn:/internal/reporting/schedule/csv_v2\n{\n
\"schedule\": {\n \"rrule\": {\n \"freq\": 3,\n \"interval\": 1,\n
\"byhour\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n
11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n
23\n ],\n \"byminute\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n
9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 19,\n 19,\n 20,\n
21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n
33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n
45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n
57,\n 58,\n 59\n ]\n }\n
},\n\"jobParams\":\n\"(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\n.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\nDiscover
session',version:'9.4.0')\"\n}\n
```\n</details>\n\n---------\n\nCo-authored-by: Davis McPhee
<davismcphee@hotmail.com>","sha":"75954f185f2a2befc2113b2d0b3d4c32a87bdb6f"}},{"branch":"9.2","label":"v9.2.4","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.1","label":"v9.1.10","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.10","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Alexi Doak <109488926+doakalexi@users.noreply.github.com>
Co-authored-by: Davis McPhee <davismcphee@hotmail.com>
kibanamachine added a commit that referenced this pull request Jan 14, 2026
…rts with relative time ranges (#248169) (#249053)

# Backport

This will backport the following commits from `main` to `9.2`:
- [[Reporting] Fix timestamp override for ES|QL CSV scheduled reports
with relative time ranges
(#248169)](#248169)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Alexi
Doak","email":"109488926+doakalexi@users.noreply.github.com"},"sourceCommit":{"committedDate":"2026-01-14T15:22:08Z","message":"[Reporting]
Fix timestamp override for ES|QL CSV scheduled reports with relative
time ranges (#248169)\n\nResolves
https://github.com/elastic/kibana/issues/245281\n\n## Summary\n\nThis PR
updates the code to generate ES|QL csv reports to use forceNow\nfor
relative time ranges. To do this we added a new locator function to\nget
the `timeFieldName` from the job params bc the ES|QL time range\nfilters
don't have the meta field populated.\n\n\n### Checklist\n\nCheck the PR
satisfies following conditions. \n\n- [ ] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n\n\n### To
verify\n\n1. Create a data view on .kibana-event-log*\n2. Use the query
below in dev tools to create a scheduled report with a\nhardcoded
relative time range (You can adjust the timerange in the job\nparams to
what you want when you're testing)\n3. Verify that the eventual CSV
report has data in the correct time\nrange\n\n<details>\n <summary> \n
<b>Query</b>\n </summary> \n\nThis scheduled report will run every
minute 🙂 \n\n ```\nPOST kbn:/internal/reporting/schedule/csv_v2\n{\n
\"schedule\": {\n \"rrule\": {\n \"freq\": 3,\n \"interval\": 1,\n
\"byhour\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n
11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n
23\n ],\n \"byminute\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n
9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 19,\n 19,\n 20,\n
21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n
33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n
45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n
57,\n 58,\n 59\n ]\n }\n
},\n\"jobParams\":\n\"(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\n.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\nDiscover
session',version:'9.4.0')\"\n}\n
```\n</details>\n\n---------\n\nCo-authored-by: Davis McPhee
<davismcphee@hotmail.com>","sha":"75954f185f2a2befc2113b2d0b3d4c32a87bdb6f","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Team:ResponseOps","backport:version","v9.3.0","v9.4.0","v9.2.4","v9.1.10","v8.19.10"],"title":"[Reporting]
Fix timestamp override for ES|QL CSV scheduled reports with relative
time
ranges","number":248169,"url":"https://github.com/elastic/kibana/pull/248169","mergeCommit":{"message":"[Reporting]
Fix timestamp override for ES|QL CSV scheduled reports with relative
time ranges (#248169)\n\nResolves
https://github.com/elastic/kibana/issues/245281\n\n## Summary\n\nThis PR
updates the code to generate ES|QL csv reports to use forceNow\nfor
relative time ranges. To do this we added a new locator function to\nget
the `timeFieldName` from the job params bc the ES|QL time range\nfilters
don't have the meta field populated.\n\n\n### Checklist\n\nCheck the PR
satisfies following conditions. \n\n- [ ] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n\n\n### To
verify\n\n1. Create a data view on .kibana-event-log*\n2. Use the query
below in dev tools to create a scheduled report with a\nhardcoded
relative time range (You can adjust the timerange in the job\nparams to
what you want when you're testing)\n3. Verify that the eventual CSV
report has data in the correct time\nrange\n\n<details>\n <summary> \n
<b>Query</b>\n </summary> \n\nThis scheduled report will run every
minute 🙂 \n\n ```\nPOST kbn:/internal/reporting/schedule/csv_v2\n{\n
\"schedule\": {\n \"rrule\": {\n \"freq\": 3,\n \"interval\": 1,\n
\"byhour\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n
11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n
23\n ],\n \"byminute\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n
9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 19,\n 19,\n 20,\n
21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n
33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n
45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n
57,\n 58,\n 59\n ]\n }\n
},\n\"jobParams\":\n\"(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\n.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\nDiscover
session',version:'9.4.0')\"\n}\n
```\n</details>\n\n---------\n\nCo-authored-by: Davis McPhee
<davismcphee@hotmail.com>","sha":"75954f185f2a2befc2113b2d0b3d4c32a87bdb6f"}},"sourceBranch":"main","suggestedTargetBranches":["9.3","9.2","9.1","8.19"],"targetPullRequestStates":[{"branch":"9.3","label":"v9.3.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/248169","number":248169,"mergeCommit":{"message":"[Reporting]
Fix timestamp override for ES|QL CSV scheduled reports with relative
time ranges (#248169)\n\nResolves
https://github.com/elastic/kibana/issues/245281\n\n## Summary\n\nThis PR
updates the code to generate ES|QL csv reports to use forceNow\nfor
relative time ranges. To do this we added a new locator function to\nget
the `timeFieldName` from the job params bc the ES|QL time range\nfilters
don't have the meta field populated.\n\n\n### Checklist\n\nCheck the PR
satisfies following conditions. \n\n- [ ] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n\n\n### To
verify\n\n1. Create a data view on .kibana-event-log*\n2. Use the query
below in dev tools to create a scheduled report with a\nhardcoded
relative time range (You can adjust the timerange in the job\nparams to
what you want when you're testing)\n3. Verify that the eventual CSV
report has data in the correct time\nrange\n\n<details>\n <summary> \n
<b>Query</b>\n </summary> \n\nThis scheduled report will run every
minute 🙂 \n\n ```\nPOST kbn:/internal/reporting/schedule/csv_v2\n{\n
\"schedule\": {\n \"rrule\": {\n \"freq\": 3,\n \"interval\": 1,\n
\"byhour\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n
11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n
23\n ],\n \"byminute\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n
9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 19,\n 19,\n 20,\n
21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n
33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n
45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n
57,\n 58,\n 59\n ]\n }\n
},\n\"jobParams\":\n\"(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\n.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\nDiscover
session',version:'9.4.0')\"\n}\n
```\n</details>\n\n---------\n\nCo-authored-by: Davis McPhee
<davismcphee@hotmail.com>","sha":"75954f185f2a2befc2113b2d0b3d4c32a87bdb6f"}},{"branch":"9.2","label":"v9.2.4","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.1","label":"v9.1.10","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.10","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Alexi Doak <109488926+doakalexi@users.noreply.github.com>
Co-authored-by: Davis McPhee <davismcphee@hotmail.com>
kibanamachine added a commit that referenced this pull request Jan 15, 2026
…orts with relative time ranges (#248169) (#249051)

# Backport

This will backport the following commits from `main` to `8.19`:
- [[Reporting] Fix timestamp override for ES|QL CSV scheduled reports
with relative time ranges
(#248169)](#248169)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Alexi
Doak","email":"109488926+doakalexi@users.noreply.github.com"},"sourceCommit":{"committedDate":"2026-01-14T15:22:08Z","message":"[Reporting]
Fix timestamp override for ES|QL CSV scheduled reports with relative
time ranges (#248169)\n\nResolves
https://github.com/elastic/kibana/issues/245281\n\n## Summary\n\nThis PR
updates the code to generate ES|QL csv reports to use forceNow\nfor
relative time ranges. To do this we added a new locator function to\nget
the `timeFieldName` from the job params bc the ES|QL time range\nfilters
don't have the meta field populated.\n\n\n### Checklist\n\nCheck the PR
satisfies following conditions. \n\n- [ ] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n\n\n### To
verify\n\n1. Create a data view on .kibana-event-log*\n2. Use the query
below in dev tools to create a scheduled report with a\nhardcoded
relative time range (You can adjust the timerange in the job\nparams to
what you want when you're testing)\n3. Verify that the eventual CSV
report has data in the correct time\nrange\n\n<details>\n <summary> \n
<b>Query</b>\n </summary> \n\nThis scheduled report will run every
minute 🙂 \n\n ```\nPOST kbn:/internal/reporting/schedule/csv_v2\n{\n
\"schedule\": {\n \"rrule\": {\n \"freq\": 3,\n \"interval\": 1,\n
\"byhour\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n
11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n
23\n ],\n \"byminute\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n
9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 19,\n 19,\n 20,\n
21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n
33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n
45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n
57,\n 58,\n 59\n ]\n }\n
},\n\"jobParams\":\n\"(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\n.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\nDiscover
session',version:'9.4.0')\"\n}\n
```\n</details>\n\n---------\n\nCo-authored-by: Davis McPhee
<davismcphee@hotmail.com>","sha":"75954f185f2a2befc2113b2d0b3d4c32a87bdb6f","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Team:ResponseOps","backport:version","v9.3.0","v9.4.0","v9.2.4","v9.1.10","v8.19.10"],"title":"[Reporting]
Fix timestamp override for ES|QL CSV scheduled reports with relative
time
ranges","number":248169,"url":"https://github.com/elastic/kibana/pull/248169","mergeCommit":{"message":"[Reporting]
Fix timestamp override for ES|QL CSV scheduled reports with relative
time ranges (#248169)\n\nResolves
https://github.com/elastic/kibana/issues/245281\n\n## Summary\n\nThis PR
updates the code to generate ES|QL csv reports to use forceNow\nfor
relative time ranges. To do this we added a new locator function to\nget
the `timeFieldName` from the job params bc the ES|QL time range\nfilters
don't have the meta field populated.\n\n\n### Checklist\n\nCheck the PR
satisfies following conditions. \n\n- [ ] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n\n\n### To
verify\n\n1. Create a data view on .kibana-event-log*\n2. Use the query
below in dev tools to create a scheduled report with a\nhardcoded
relative time range (You can adjust the timerange in the job\nparams to
what you want when you're testing)\n3. Verify that the eventual CSV
report has data in the correct time\nrange\n\n<details>\n <summary> \n
<b>Query</b>\n </summary> \n\nThis scheduled report will run every
minute 🙂 \n\n ```\nPOST kbn:/internal/reporting/schedule/csv_v2\n{\n
\"schedule\": {\n \"rrule\": {\n \"freq\": 3,\n \"interval\": 1,\n
\"byhour\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n
11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n
23\n ],\n \"byminute\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n
9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 19,\n 19,\n 20,\n
21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n
33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n
45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n
57,\n 58,\n 59\n ]\n }\n
},\n\"jobParams\":\n\"(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\n.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\nDiscover
session',version:'9.4.0')\"\n}\n
```\n</details>\n\n---------\n\nCo-authored-by: Davis McPhee
<davismcphee@hotmail.com>","sha":"75954f185f2a2befc2113b2d0b3d4c32a87bdb6f"}},"sourceBranch":"main","suggestedTargetBranches":["9.3","9.2","9.1","8.19"],"targetPullRequestStates":[{"branch":"9.3","label":"v9.3.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/248169","number":248169,"mergeCommit":{"message":"[Reporting]
Fix timestamp override for ES|QL CSV scheduled reports with relative
time ranges (#248169)\n\nResolves
https://github.com/elastic/kibana/issues/245281\n\n## Summary\n\nThis PR
updates the code to generate ES|QL csv reports to use forceNow\nfor
relative time ranges. To do this we added a new locator function to\nget
the `timeFieldName` from the job params bc the ES|QL time range\nfilters
don't have the meta field populated.\n\n\n### Checklist\n\nCheck the PR
satisfies following conditions. \n\n- [ ] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n\n\n### To
verify\n\n1. Create a data view on .kibana-event-log*\n2. Use the query
below in dev tools to create a scheduled report with a\nhardcoded
relative time range (You can adjust the timerange in the job\nparams to
what you want when you're testing)\n3. Verify that the eventual CSV
report has data in the correct time\nrange\n\n<details>\n <summary> \n
<b>Query</b>\n </summary> \n\nThis scheduled report will run every
minute 🙂 \n\n ```\nPOST kbn:/internal/reporting/schedule/csv_v2\n{\n
\"schedule\": {\n \"rrule\": {\n \"freq\": 3,\n \"interval\": 1,\n
\"byhour\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n
11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n
23\n ],\n \"byminute\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n
9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 19,\n 19,\n 20,\n
21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n
33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n
45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n
57,\n 58,\n 59\n ]\n }\n
},\n\"jobParams\":\n\"(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\n.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\nDiscover
session',version:'9.4.0')\"\n}\n
```\n</details>\n\n---------\n\nCo-authored-by: Davis McPhee
<davismcphee@hotmail.com>","sha":"75954f185f2a2befc2113b2d0b3d4c32a87bdb6f"}},{"branch":"9.2","label":"v9.2.4","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.1","label":"v9.1.10","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.10","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Alexi Doak <109488926+doakalexi@users.noreply.github.com>
Co-authored-by: Davis McPhee <davismcphee@hotmail.com>
kibanamachine added a commit that referenced this pull request Jan 15, 2026
…rts with relative time ranges (#248169) (#249054)

# Backport

This will backport the following commits from `main` to `9.3`:
- [[Reporting] Fix timestamp override for ES|QL CSV scheduled reports
with relative time ranges
(#248169)](#248169)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Alexi
Doak","email":"109488926+doakalexi@users.noreply.github.com"},"sourceCommit":{"committedDate":"2026-01-14T15:22:08Z","message":"[Reporting]
Fix timestamp override for ES|QL CSV scheduled reports with relative
time ranges (#248169)\n\nResolves
https://github.com/elastic/kibana/issues/245281\n\n## Summary\n\nThis PR
updates the code to generate ES|QL csv reports to use forceNow\nfor
relative time ranges. To do this we added a new locator function to\nget
the `timeFieldName` from the job params bc the ES|QL time range\nfilters
don't have the meta field populated.\n\n\n### Checklist\n\nCheck the PR
satisfies following conditions. \n\n- [ ] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n\n\n### To
verify\n\n1. Create a data view on .kibana-event-log*\n2. Use the query
below in dev tools to create a scheduled report with a\nhardcoded
relative time range (You can adjust the timerange in the job\nparams to
what you want when you're testing)\n3. Verify that the eventual CSV
report has data in the correct time\nrange\n\n<details>\n <summary> \n
<b>Query</b>\n </summary> \n\nThis scheduled report will run every
minute 🙂 \n\n ```\nPOST kbn:/internal/reporting/schedule/csv_v2\n{\n
\"schedule\": {\n \"rrule\": {\n \"freq\": 3,\n \"interval\": 1,\n
\"byhour\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n
11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n
23\n ],\n \"byminute\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n
9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 19,\n 19,\n 20,\n
21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n
33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n
45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n
57,\n 58,\n 59\n ]\n }\n
},\n\"jobParams\":\n\"(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\n.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\nDiscover
session',version:'9.4.0')\"\n}\n
```\n</details>\n\n---------\n\nCo-authored-by: Davis McPhee
<davismcphee@hotmail.com>","sha":"75954f185f2a2befc2113b2d0b3d4c32a87bdb6f","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Team:ResponseOps","backport:version","v9.3.0","v9.4.0","v9.2.4","v9.1.10","v8.19.10"],"title":"[Reporting]
Fix timestamp override for ES|QL CSV scheduled reports with relative
time
ranges","number":248169,"url":"https://github.com/elastic/kibana/pull/248169","mergeCommit":{"message":"[Reporting]
Fix timestamp override for ES|QL CSV scheduled reports with relative
time ranges (#248169)\n\nResolves
https://github.com/elastic/kibana/issues/245281\n\n## Summary\n\nThis PR
updates the code to generate ES|QL csv reports to use forceNow\nfor
relative time ranges. To do this we added a new locator function to\nget
the `timeFieldName` from the job params bc the ES|QL time range\nfilters
don't have the meta field populated.\n\n\n### Checklist\n\nCheck the PR
satisfies following conditions. \n\n- [ ] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n\n\n### To
verify\n\n1. Create a data view on .kibana-event-log*\n2. Use the query
below in dev tools to create a scheduled report with a\nhardcoded
relative time range (You can adjust the timerange in the job\nparams to
what you want when you're testing)\n3. Verify that the eventual CSV
report has data in the correct time\nrange\n\n<details>\n <summary> \n
<b>Query</b>\n </summary> \n\nThis scheduled report will run every
minute 🙂 \n\n ```\nPOST kbn:/internal/reporting/schedule/csv_v2\n{\n
\"schedule\": {\n \"rrule\": {\n \"freq\": 3,\n \"interval\": 1,\n
\"byhour\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n
11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n
23\n ],\n \"byminute\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n
9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 19,\n 19,\n 20,\n
21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n
33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n
45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n
57,\n 58,\n 59\n ]\n }\n
},\n\"jobParams\":\n\"(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\n.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\nDiscover
session',version:'9.4.0')\"\n}\n
```\n</details>\n\n---------\n\nCo-authored-by: Davis McPhee
<davismcphee@hotmail.com>","sha":"75954f185f2a2befc2113b2d0b3d4c32a87bdb6f"}},"sourceBranch":"main","suggestedTargetBranches":["9.3","9.2","9.1","8.19"],"targetPullRequestStates":[{"branch":"9.3","label":"v9.3.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/248169","number":248169,"mergeCommit":{"message":"[Reporting]
Fix timestamp override for ES|QL CSV scheduled reports with relative
time ranges (#248169)\n\nResolves
https://github.com/elastic/kibana/issues/245281\n\n## Summary\n\nThis PR
updates the code to generate ES|QL csv reports to use forceNow\nfor
relative time ranges. To do this we added a new locator function to\nget
the `timeFieldName` from the job params bc the ES|QL time range\nfilters
don't have the meta field populated.\n\n\n### Checklist\n\nCheck the PR
satisfies following conditions. \n\n- [ ] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n\n\n### To
verify\n\n1. Create a data view on .kibana-event-log*\n2. Use the query
below in dev tools to create a scheduled report with a\nhardcoded
relative time range (You can adjust the timerange in the job\nparams to
what you want when you're testing)\n3. Verify that the eventual CSV
report has data in the correct time\nrange\n\n<details>\n <summary> \n
<b>Query</b>\n </summary> \n\nThis scheduled report will run every
minute 🙂 \n\n ```\nPOST kbn:/internal/reporting/schedule/csv_v2\n{\n
\"schedule\": {\n \"rrule\": {\n \"freq\": 3,\n \"interval\": 1,\n
\"byhour\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n
11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n
23\n ],\n \"byminute\": [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n
9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 19,\n 19,\n 20,\n
21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n 30,\n 31,\n 32,\n
33,\n 34,\n 35,\n 36,\n 37,\n 38,\n 39,\n 40,\n 41,\n 42,\n 43,\n 44,\n
45,\n 46,\n 47,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n
57,\n 58,\n 59\n ]\n }\n
},\n\"jobParams\":\n\"(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\n.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\nDiscover
session',version:'9.4.0')\"\n}\n
```\n</details>\n\n---------\n\nCo-authored-by: Davis McPhee
<davismcphee@hotmail.com>","sha":"75954f185f2a2befc2113b2d0b3d4c32a87bdb6f"}},{"branch":"9.2","label":"v9.2.4","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.1","label":"v9.1.10","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.10","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Alexi Doak <109488926+doakalexi@users.noreply.github.com>
Co-authored-by: Davis McPhee <davismcphee@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels bug Fixes for quality problems that affect the customer experience release_note:fix Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t// v8.19.10 v8.19.11 v9.1.10 v9.1.11 v9.2.4 v9.2.5 v9.3.0 v9.4.0

5 participants