Skip to content

[ES|QL] Support implicit casting from string literals to intervals - Date_Period and Time_Duration in EsqlQueryRequest params #115352

@fang-xing-esql

Description

@fang-xing-esql

With #109193 users can provide Date_Period or Time_Duration intervals in EsqlQueryRequest params by casting them to the desired types, here is an example,

{
 "query": "from sample_data | stats var0 = AVG(event.duration) by BUCKET(@timestamp, ?interval::time_duration)",
 "params": [
  {
   "interval": "1 minute"
  }
 ]
}

The goal of this issue is to do implicit casting from string literals to Date_Period or Time_Duration, so that users don't have to convert them explicitly, like the examples below.

{
 "query": "from sample_data | stats var0 = AVG(event.duration) by BUCKET(@timestamp, ?interval)",
 "params": [
  {
   "interval": "1 minute"
  }
 ]
}

There are some other places that Date_Period or Time_Duration intervals can be used besides BUCKET, like datetime +/- intervals, we will try to make it work also, more examples will be added.

Metadata

Metadata

No fields configured for Enhancement.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions