Skip to content

[OneWorkflow] Add datemath support to KQL evaluator#252840

Merged
dej611 merged 5 commits intoelastic:mainfrom
dej611:fix/14815
Feb 13, 2026
Merged

[OneWorkflow] Add datemath support to KQL evaluator#252840
dej611 merged 5 commits intoelastic:mainfrom
dej611:fix/14815

Conversation

@dej611
Copy link
Contributor

@dej611 dej611 commented Feb 12, 2026

Summary

  • Adds datemath expression support (e.g. now, now-1d, now-7d/d, 2025-01-01T00:00:00.000Z||+1d) to the KQL evaluator used by the workflows execution engine
  • When a KQL literal value is a valid datemath expression, it is resolved to an ISO date string before comparison, enabling time-relative filtering in workflow conditions
  • Adds comprehensive unit tests covering datemath in "is" expressions, range expressions, rounding, anchor syntax, and fallback behavior for non-datemath strings

Screenshot

Screenshot 2026-02-12 at 12 12 31
@dej611 dej611 changed the title fix: Add datemath support to KQL evaluator in workflows execution engine Feb 12, 2026
@dej611 dej611 added release_note:fix backport:version Backport to applied version labels Team:One Workflow Team label for One Workflow (Workflow automation) v9.4.0 v9.3.1 labels Feb 12, 2026
@dej611 dej611 marked this pull request as ready for review February 12, 2026 15:11
@dej611 dej611 requested a review from a team as a code owner February 12, 2026 15:11
Copy link
Contributor

@rosomri rosomri left a comment

Choose a reason for hiding this comment

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

lgtm, one comment

sourceRoot: src/platform/plugins/shared/workflows_execution_engine
dependsOn:
- '@kbn/core'
- '@kbn/datemath'
Copy link
Contributor

Choose a reason for hiding this comment

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

datemath appears twice in the dependsOn list, once replacing @kbn/core at the top, and once added after @kbn/es-query

Copy link
Contributor

Choose a reason for hiding this comment

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

the execution engine has 30+ files importing from @kbn/core/server and @kbn/core/public. It appears the @kbn/core line was accidentally overwritten by @kbn/datemath

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right. The file was autogenerated twice and for some reason core has been kicked out.
Will autogenerate again and make sure this time is correct

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed with ff823c6

@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

✅ unchanged

History

@dej611 dej611 requested a review from rosomri February 13, 2026 08:47
Copy link
Contributor

@rosomri rosomri left a comment

Choose a reason for hiding this comment

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

lgtm

@dej611 dej611 merged commit 3c4e4ac into elastic:main Feb 13, 2026
16 checks passed
@dej611 dej611 deleted the fix/14815 branch February 13, 2026 10:24
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 9.3

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

kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Feb 13, 2026
## Summary

- Adds datemath expression support (e.g. `now`, `now-1d`, `now-7d/d`,
`2025-01-01T00:00:00.000Z||+1d`) to the KQL evaluator used by the
workflows execution engine
- When a KQL literal value is a valid datemath expression, it is
resolved to an ISO date string before comparison, enabling time-relative
filtering in workflow conditions
- Adds comprehensive unit tests covering datemath in "is" expressions,
range expressions, rounding, anchor syntax, and fallback behavior for
non-datemath strings

## Screenshot

<img width="1488" height="472" alt="Screenshot 2026-02-12 at 12 12 31"
src="https://github.com/user-attachments/assets/b71fe08c-169c-46f3-880b-045cf403fd2b"
/>

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 3c4e4ac)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
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 Feb 13, 2026
…253028)

# Backport

This will backport the following commits from `main` to `9.3`:
- [[OneWorkflow] Add datemath support to KQL evaluator
(#252840)](#252840)

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

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

<!--BACKPORT [{"author":{"name":"Marco
Liberati","email":"dej611@users.noreply.github.com"},"sourceCommit":{"committedDate":"2026-02-13T10:23:55Z","message":"[OneWorkflow]
Add datemath support to KQL evaluator (#252840)\n\n## Summary\n\n- Adds
datemath expression support (e.g. `now`, `now-1d`,
`now-7d/d`,\n`2025-01-01T00:00:00.000Z||+1d`) to the KQL evaluator used
by the\nworkflows execution engine\n- When a KQL literal value is a
valid datemath expression, it is\nresolved to an ISO date string before
comparison, enabling time-relative\nfiltering in workflow conditions\n-
Adds comprehensive unit tests covering datemath in \"is\"
expressions,\nrange expressions, rounding, anchor syntax, and fallback
behavior for\nnon-datemath strings\n\n## Screenshot\n\n<img
width=\"1488\" height=\"472\" alt=\"Screenshot 2026-02-12 at 12 12
31\"\nsrc=\"https://github.com/user-attachments/assets/b71fe08c-169c-46f3-880b-045cf403fd2b\"\n/>\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"3c4e4acff2db086a2d58a84aafdd6f04f66dc3ac","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","backport:version","Team:One
Workflow","v9.4.0","v9.3.1"],"title":"[OneWorkflow] Add datemath support
to KQL
evaluator","number":252840,"url":"https://github.com/elastic/kibana/pull/252840","mergeCommit":{"message":"[OneWorkflow]
Add datemath support to KQL evaluator (#252840)\n\n## Summary\n\n- Adds
datemath expression support (e.g. `now`, `now-1d`,
`now-7d/d`,\n`2025-01-01T00:00:00.000Z||+1d`) to the KQL evaluator used
by the\nworkflows execution engine\n- When a KQL literal value is a
valid datemath expression, it is\nresolved to an ISO date string before
comparison, enabling time-relative\nfiltering in workflow conditions\n-
Adds comprehensive unit tests covering datemath in \"is\"
expressions,\nrange expressions, rounding, anchor syntax, and fallback
behavior for\nnon-datemath strings\n\n## Screenshot\n\n<img
width=\"1488\" height=\"472\" alt=\"Screenshot 2026-02-12 at 12 12
31\"\nsrc=\"https://github.com/user-attachments/assets/b71fe08c-169c-46f3-880b-045cf403fd2b\"\n/>\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"3c4e4acff2db086a2d58a84aafdd6f04f66dc3ac"}},"sourceBranch":"main","suggestedTargetBranches":["9.3"],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/252840","number":252840,"mergeCommit":{"message":"[OneWorkflow]
Add datemath support to KQL evaluator (#252840)\n\n## Summary\n\n- Adds
datemath expression support (e.g. `now`, `now-1d`,
`now-7d/d`,\n`2025-01-01T00:00:00.000Z||+1d`) to the KQL evaluator used
by the\nworkflows execution engine\n- When a KQL literal value is a
valid datemath expression, it is\nresolved to an ISO date string before
comparison, enabling time-relative\nfiltering in workflow conditions\n-
Adds comprehensive unit tests covering datemath in \"is\"
expressions,\nrange expressions, rounding, anchor syntax, and fallback
behavior for\nnon-datemath strings\n\n## Screenshot\n\n<img
width=\"1488\" height=\"472\" alt=\"Screenshot 2026-02-12 at 12 12
31\"\nsrc=\"https://github.com/user-attachments/assets/b71fe08c-169c-46f3-880b-045cf403fd2b\"\n/>\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"3c4e4acff2db086a2d58a84aafdd6f04f66dc3ac"}},{"branch":"9.3","label":"v9.3.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Marco Liberati <dej611@users.noreply.github.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 release_note:fix Team:One Workflow Team label for One Workflow (Workflow automation) v9.3.1 v9.4.0

4 participants