因此,我有以下日期格式,我想在elasticsearch中导入为日期字段:
2015-01-12T03:00:00
不幸的是,elasticsearch无法通过以下Map识别这种格式:
{
"mappings": {
"veenendaal_type_new": {
"properties": {
"1061_Mundo_Sport_Veenendaal": {
"type": "integer"
},
"1076_We_Veenendaal_Bernard_van_Kreelpoort": {
"type": "integer"
},
"1103_V&D_Veenendaal": {
"type": "integer"
},
"1167_Action_Veenendaal": {
"type": "integer"
},
"1171_Speksnijder_Veenendaal": {
"type": "integer"
},
"1178_Ingang_Corridor_t_h_v__C&A_Veenendaal": {
"type": "integer"
},
"1181_Ingang_Corridor_t_h_v__Bart_Smit_Veenendaal": {
"type": "integer"
},
"1183_De_Heren_van_XVII_Veenendaal": {
"type": "integer"
},
"1184_Corridor_t_h_v__CandyShop_Veenendaal": {
"type": "integer"
},
"1186_Corridor_t_h_v__Het_Goudhaantje_Veenendaal": {
"type": "integer"
},
"1188_Takko_Veenendaal": {
"type": "integer"
},
"1212_De_Cultuurfabriek_Veenendaal": {
"type": "integer"
},
"1216_Jac_Hensen_Veenendaal": {
"type": "integer"
},
"1505_Floral_Haircare_Veenendaal": {
"type": "integer"
},
"201_WE_Veenendaal": {
"type": "integer"
},
"940_HEMA_Veenendaal": {
"type": "integer"
},
"Tijdsperiode": {
"type": "date"
}
}
}
}
}
Elasticsearch返回以下错误:
MapperParsingException[failed to parse [Tijdsperiode]]; nested: IllegalArgumentException[Invalid format: "2015-01-12T03:00:00" is malformed at "T03:00:00"];
我的问题是,我如何使这个格式**(2015-01- 12 T03:00:00)**对elasticsearch有效?
3条答案
按热度按时间kgsdhlau1#
在PHP中,像这样:
btxsgosb2#
在索引定义中使用以下命令:
"Tijdsperiode": { "type": "date", "format": "yyyy-MM-dd'T'HH:mm:ssZ" }
或者
"format": "date_time_no_millis"
http://www.elasticsearch.com/docs/elasticsearch/mapping/date_format/
5lhxktic3#
对于像
2022-06-14 19:29:06 +00:00
这样的日期,这在“格式”中对我有效:yyyy-MM-dd HH:mm:ss ZZZZZ
此处参考:https://www.elastic.co/guide/en/elasticsearch/reference/current/date.html