How do i convert epoch millis time to date in ES using query?

Hi All,

I wanted to display the date_histogram facet in human readable format but it gives me the time in epoch millis , is there any way where i can convert it to normal date in query?

Query which i have tried
{
"facets": {
"0": {
"date_histogram": {
"field": "DEPLOY_TIME",
"interval": "1d",
"format': "dd-MM-yyyy"
}
}

but still above query giving me the date in epoch millis only (as shown below)
facets: {
0: {
_type: date_histogram
entries: [
{
time: 1390176000000
count: 4
}
{
time: 1391472000000
count: 1
}
}

need your help here to convert to normal date through ES query only.

Thanks,
Rohan

Use aggregation instead of facet and you will get it.

1 Like