Viewing the documents on per weekday classification?

Hi,

i have data like this
{"text": "are","created_at": "2017-01-29T05:30:36.000Z"} --sunday
{"text": "hi","created_at": "2017-01-28T18:30:36.000Z"}--saturday
{"text": "you","created_at": "2017-01-31T09:30:36.000Z"} --tuesday
{"text": "how","created_at": "2017-01-28T11:30:36.000Z"}--sunday
{"text": "hello","created_at": "2017-01-30T23:30:36.000Z"}--monday

For viewing documents on per weekday classification i used the below groovy script:
Date date = new Date(doc[date_field].value); date.format(format);

But in my output i am different days :

 "aggregations": {
    "byDays": {
      "doc_count_error_upper_bound": 0,
      "sum_other_doc_count": 0,
      "buckets": [
        {
          "key": "Sunday",
          "doc_count": 2
        },
        {
          "key": "Tuesday",
          "doc_count": 2
        },
        {
          "key": "Saturday",
          "doc_count": 1
        }
      ]
    }
  }
}

Do i need to change the timezone to get the accurate days?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.