So, i have the following date format which i want to import in elasticsearch as a date field :
2015-01-12T03:00:00
Unfortunately, this format is not recognised by elasticsearch with the following mapping :
{
"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 returns this error :
MapperParsingException[failed to parse [Tijdsperiode]]; nested: IllegalArgumentException[Invalid format: "2015-01-12T03:00:00" is malformed at "T03:00:00"];
My question is, how can i make this format (2015-01-12T03:00:00) valid for elasticsearch?
Use this in your index definition :
"Tijdsperiode": { "type": "date", "format": "yyyy-MM-dd'T'HH:mm:ssZ" }
or maybe
"format": "date_time_no_millis"
http://www.elasticsearch.com/docs/elasticsearch/mapping/date_format/
在php中,如下所示:
date("c", $date_string);//ISO 8601 2004-02-12T15:19:21+00:00
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.