Kibana discover show wrong result when filter by date type field

I created an index template 'order-index-template' which defined a date type mapping:

...
  "index_patterns": [
    "order-index"
  ],
"mappings": {
    "properties": {
      "orderTime": {
        "type": "date"
      }
    }
  }
...

and put one order doc to index:

put /order-index/_doc/1
{
  ...
   "orderTime": 1702518274554
}

I'm in China and in Kibana Discover it shows document orderTime correctly as : 'Dec 14, 2023 @ 09:44:34.554'

But when I type 'orderTime: 1702518274554' in filter input box and click refresh button, no result showed.

If I add 836001000 to 1702518274554 = 1702547074554 and type 'orderTime: 1702547074554' in filter box and click refresh button, it return the document and the 'orderTime' field is shown as 'Dec 14, 2023 @ 09:44:34.554'.

If I change the timezone of Kibana from 'Browser' to 'UTC', and type 'orderTime: 1702518274554' in filter input box , kibana can return the document correctly and the 'orderTime' field is shown as 'Dec 14, 2023 @ 01:44:34.554'.

Finally, I changed timezone back to 'Browser' and tried search in Dev Console tools and it can return correct document.

GET /order-index/_search
{
  "query": {
    "match": {
      "orderTime":1702518274554
    }
  }
}

ES and Kibana version is 8.5.

I'm confused and is this a KQL bug ?

Thanks.

Note: It 's 8 x 3600 x 1000 = 8 hours duration in million seconds, not 836001000, the '*' is disappeared.

This issue can be reproduced easily, no one knows why?

Thanks.

Hi @bbhhhh,

Welcome to the community!

Yes, when searched via the query bar, the current time zone will be applied too.

For your case, there is an option to add it rather as a filter in Discover and define it via Query DSL so it works similarly to the mentioned DevTools request.

There is also an open github discussion about the differences in how query vs filters work currently with dates [Unified Search] Discrepancy between filter pills and query bar for date fields · Issue #172097 · elastic/kibana · GitHub

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.