英文:
Kibana date filter Elasticsearch error "failed to parse date field [2023-01-01T00:00:00.000+02:00] with format [dd/MM/yyyy HH:mm:ss Z||epoch_millis]
问题
I have a date field in my Elasticsearch index mapped like:
"updated_at": {
"format": "dd/MM/yyyy HH:mm:ss Z||epoch_millis",
"type": "date"
},
The value in the docs _source
are epoch millis like "created_at": 1676689641549
If I use the Kibana 7.10 query interface to add a filter like this
This returns the error
"failed to parse date field [2023-01-01T00:00:00.000+01:00] with format [dd/MM/yyyy HH:mm:ss Z||epoch_millis]"
Is there a setting in Kibana 7.10 or in my Elasticsearch mapping that makes the filter UI and the index query play nicely together?
UPDATE 4. Jul 2023: The query generated by Kibana looks like this:
"query": {
"bool": {
"must": [],
"filter": [
{
"match_all": {}
},
{
"range": {
"created_at": {
"gte": "2022-01-01T00:00:00.000+01:00",
"lt": "2023-01-01T00:00:00.000+01:00"
}
}
}
],
"should": [],
"must_not": []
}
},
英文:
I have a date field in my Elasticsearch index mapped like:
"updated_at": {
"format" : "dd/MM/yyyy HH:mm:ss Z||epoch_millis",
"type": "date"
},
The value in the docs _source
are epoch millis like "created_at": 1676689641549
If I use the Kibana 7.10 query interface to add a filter like this
This returns the error
> "failed to parse date field [2023-01-01T00:00:00.000+01:00] with format [dd/MM/yyyy HH:mm:ss Z||epoch_millis]"
Is there a setting in Kibana 7.10 or in my Elasticsearch mapping that makes the filter UI and the index query play nicely together?
NOTES:
-
If I enter the values in milliseconds, the filer works correctly
-
This is related to, but not solved by, this previous question /63352320/elasticsearch-parse-date-field-in-different-format
UPDATE 4. Jul 2023: The query generated by Kibana looks like this:
"query": {
"bool": {
"must": [],
"filter": [
{
"match_all": {}
},
{
"range": {
"created_at": {
"gte": "2022-01-01T00:00:00.000+01:00",
"lt": "2023-01-01T00:00:00.000+01:00"
}
}
}
],
"should": [],
"must_not": []
}
},
答案1
得分: 1
这只是在我更新映射并重新索引时才有效:
"created_at": {
"type": "date",
"format": "date_time||epoch_millis"
},
感谢 @val 的建议!
英文:
This just worked when I updated the mappings and reindexed with:
"created_at": {
"type": "date",
"format": "date_time||epoch_millis"
},
Thanks @val for the suggestion!
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论