Reputation: 613
I create an index in ES7.8 with date format "yyyy-MM-dd"
"mappings": {
"_doc": {
"properties": {
"BaseLine": {
"type": "date",
"format": "yyyy-MM-dd"
},
However, when I click the "Baseline" field on the map, the actual value passed on Filter is yyyy-MM-dd00:00:00.000Z.
Can anyone advise how can I get the correct date format "yyyy-MM-dd" in the filter?
Thanks.
Here is the sample document from a request
"hits" : [ { "_index" : "program_b", "_type" : "_doc", "_id" : "2137SD19.1", "_score" : 0.0, "_source" : { "SiteID" : 2137, "BaseLine" : "2020-04-26", "uk" : "2137SD19.1" } },
Upvotes: 0
Views: 2186
Reputation: 217254
The role of the "format": "yyyy-MM-dd"
in your mapping is only to tell ES in which format your date values will be present in your source document.
As you can see, your source document contains "BaseLine" : "2020-04-26"
which is exactly in the format that you've instructed ES to expect. When you index your document, ES will properly parse your BaseLine
date field and index a long value representing that point in time.
The value you see in the tooltip (i.e. Apr 26, 2020
) is just how Kibana formats your dates, you can change that in "Stack Management > Advanced settings" if needed.
Finally, the filter value you see in your filter (i.e. 2020-04-26T00:00:00.000Z
) is the ISO8601 representation of your BaseLine
field and what ES use in the query filter.
Everything looks perfectly correct as far as I can tell.
Upvotes: 2