Skip to content

[ES|QL] comparison between date-like params and date_nanos fields is failing #125439

Closed
@drewdaemon

Description

@drewdaemon

Elasticsearch Version

main

Installed Plugins

No response

Java Version

bundled

OS Version

Darwin Kernel Version 24.3.0: Thu Jan 2 20:24:22 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6041 arm64

Problem Description

Kibana's time picker params are causing errors when compared with date_nanos fields.

Image

Steps to Reproduce

This is the query that is sent

POST /_query/async?drop_null_columns
{
  "query": "FROM sample* | WHERE date_nanos >= ?_tstart AND date_nanos <= ?_tend | LIMIT 10",
  "locale": "en",
  "include_ccs_metadata": true,
  "params": [
    {
      "_tstart": "2010-03-20T15:08:25.608Z"
    },
    {
      "_tend": "2025-03-20T15:08:25.608Z"
    }
  ],
  "filter": {
    "bool": {
      "must": [],
      "filter": [
        {
          "range": {
            "date_nanos": {
              "format": "strict_date_optional_time",
              "gte": "2010-03-20T15:08:25.608Z",
              "lte": "2025-03-20T15:08:25.608Z"
            }
          }
        }
      ],
      "should": [],
      "must_not": []
    }
  }
}

And the mappings for that index

PUT sample/_mapping
{
  "properties": {
    "keyword_key": {
      "type": "keyword"
    },
    "text_message": {
      "type": "text"
    },
    "number_amount": {
      "type": "long"
    },
    "number_price": {
      "type": "float"
    },
    "bool_enabled": {
      "type": "boolean"
    },
    "binary_blob": {
      "type": "binary"
    },
    "date": {
      "type": "date"
    },
    "date_nanos": {
      "type": "date_nanos"
    },
    "object_user": {
      "properties": {
        "first": { "type": "text" },
        "last": { "type": "text" }
      }
    },
    "nested_user": {
      "type": "nested"
    },
    "flattened_labels": {
      "type": "flattened"
    },
    "range_time_frame": {
      "type": "date_range", 
      "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
    },
    "ip_addr": {
      "type": "ip"
    },
    "version": {
      "type": "version"
    },
    "vector": {
      "type": "dense_vector",
      "dims": 3
    },
    "geo_point": {
      "type": "geo_point"
    },
    "histogram" : {
      "type" : "histogram"
    },
    "rank_features": {
      "type": "rank_features" 
    },
    "geometry": {
      "type": "shape"
    }
  }
}

Logs (if relevant)

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions