How can I change timefield to have browser timezone using script?

Hello,

I'm using version 8.6.0 in elastic cloud.

I need to separate a timefield according to the day of the week. The way I'm doing it considers the UTC +00.00, but I would like it to be split according to the browser's timezone, how can I do that?

Here is the body of my data:

body: {
  "aggs": {
    "day_of_week": {
      "histogram": {
        "script": {
          "source": "return doc['my_date'].value.getDayOfWeekEnum().getValue();"
        },
        "interval": 1,
        "min_doc_count": 0,
        "extended_bounds": {
          "min": 1,
          "max": 7
        }
      }
    }
  }
}

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