I need to retrieve all the records between Start of the day to End of the day
For Eg: 2018-01-29 00:00:00 - 2018-01-29 23:59:59
Similarly, I need to get current Time and Date.
GET _search
{
"size": 1,
"script_fields": {
"now": {
"script": "new Date().getTime()"
}
}
}
But this gives me the result as
{
"took": 11,
"timed_out": false,
"_shards": {
"total": 76,
"successful": 76,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 17257117,
"max_score": 1,
"hits": [
{
"_index": ".kibana",
"_type": "doc",
"_id": "index-pattern:c23523c0-f6b7-11e7-864f-3d5a306a7451",
"_score": 1,
"fields": {
"now": [
1517230755079
]
}
}
]
}
}
But the required Format is
{
"took": 11,
"timed_out": false,
"_shards": {
"total": 76,
"successful": 76,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 17257117,
"max_score": 1,
"hits": [
{
"_index": ".kibana",
"_type": "doc",
"_id": "index-pattern:c23523c0-f6b7-11e7-864f-3d5a306a7451",
"_score": 1,
"fields": {
"now": [
2018-01-29 18:33:42
]
}
}
]
}
}