I have created a test index in elasticsearch with mapping for 2 date fields. Both fields have custom format as shown below.
{
"test" : {
"mappings" : {
"_doc" : {
"properties" : {
"endTime" : {
"type" : "date",
"format" : "yyyy-MM-dd HH:mm:ss.SSS"
},
"startTime" : {
"type" : "date",
"format" : "yyyy-MM-dd HH:mm:ss.SSS"
}
}
}
}
}
}
Data i have loaded for this sample test index looks like below.
PUT test/_doc
{
"startTime" : "2019-02-26 00:00:00.000",
"endTime" : "2019-02-27 00:00:00.000"
}
I am trying to query based on range but it doesnt return any result. Am i missing something? My query for range is as below.
GET test/_doc/search
{
"query": {
"bool": {
"must": {
"range": {
"endTime": {
"gte": "2019-02-25 00:00:00.000",
"format" : "yyyy-MM-dd HH:mm:ss.SSS"
}
}
}
}
}
}