Hello. I am trying to import a .csv file to Elasticsearch. In the .csv file there is a date field in the "yyyyMMdd" format (for example 20220326). This is what I have in my logstash conf file:
filter {
date {
match => ["date", "yyyyMMdd"]
target => "date"
}
}
After I imported the file I realized that it saves the date one day early, for example if I had the date 20220326 in the .csv file, this is what I get in Elasticsearch (on Kibana console): 2022-03-25T23:00:00.000Z.
Thank you for the reply. This didn't really solve my problem - it still saves he wrong day. Is there a way to save the date without time? For example, to be just 2022-03-26?
The thing is, i need to import the file to an index that is already created with date fields. But if i import the file without the date filters, when i call the query i get the date as 20210362 which is good but in Kibana Discover it saves the date as "+20210326-01-01T00:00:00.000Z" and i'm not able to create any visualizations. Maybe the problem is in Kibana and i can manually change the format there?
Sorry btw i'm very new at Elasticsearch. In my case that doesn't really change anything, cause it saves the whole date as the year aka 20210326-01-01T00:00:00.000Z instead of 2021-03-26T00:00:00.000Z (without using the date filters that i mentioned above)
PUT timezone
{
"mappings": {
"properties": {
"date": {
"type": "date",
"format": "yyyyMMdd"
}
}
}
}
POST timezone/_doc
{
"date": "20220326"
}
GET timezone/_search
#notice the date field shows exactly what you entered. No conversion.
Kibana in Discovery and Visualizations datetime conversion happens for each user based on the settings in Kibana.
Discover date field = Mar 25, 2022 @ 20:00:00.000 with timezone setting to equal browser. I am -4 hours from UTC.
Discover date field = Mar 26, 2022 @ 00:00:00.000 with timezone setting to UTC.
I think you might be missing the part where Kibana is auto translating timestamps based on your Kibana settings.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.