I have been having issues with using a date formatter. I am running elasticsearch 6.1. I have ran multiple test scenarios and keep coming up with the same issue. If I include .SSS for milliseconds, the formatter does not recognize the input and my date becomes a string (ie: unsearchable error).
PUT /someindex
{
"mappings": {
"sigui": {
"properties": {
"timestamp": {
"type": "date",
"format": "yyyy/MM/dd HH:mm:ss.SSS"
}
}
}
}
}
POST /someindex/sometype/1001
{
"terminal":"025",
"body":{
"timestamp":"2018/01/26 12:23:45.123",
"freeMemory":16024936,
"data":{
"properties":{
"subState":"11038",
"terminalNumber":"025",
"dataCategory":"POS_DEVICE",
"element-name":"dataEvent"
},
"securePropertyMap":{
},
"nestLevel":0,
"children":[
],
"mUID":{
"unique":-985307935,
"time":1516994907293,
"count":-31538
}
}
}
}
If I drop the .SSS I my date is recognized and I am able to search my dates. What is causing the issue?
Lastly, why can't I use a date in the format MM/dd/yyyy HH:mm:ss? Notice the order of the date.
PUT /someindex
{
"mappings": {
"sigui": {
"properties": {
"timestamp": {
"type": "date",
"format": "yyyy/MM/dd HH:mm:ss"
}
}
}
}
}
POST /someindex/sometype/1001
{
"terminal":"025",
"body":{
"timestamp":"2018/01/26 12:23:45",
"freeMemory":16024936,
"data":{
"properties":{
"subState":"11038",
"terminalNumber":"025",
"dataCategory":"POS_DEVICE",
"element-name":"dataEvent"
},
"securePropertyMap":{
},
"nestLevel":0,
"children":[
],
"mUID":{
"unique":-985307935,
"time":1516994907293,
"count":-31538
}
}
}
}