Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust time according to local timezone #403

Closed
wants to merge 1 commit into from

Conversation

bobrik
Copy link

@bobrik bobrik commented Aug 23, 2013

If "browser" timezone is specified then date histograms for periods larger that 1h will be aligned to local timezone.

Here in Europe/Moscow (UTC+4) if you histogram interval is set to 1d then days start at 4AM. With this patch days are aligned to 00:00. It would be great if someone could confirm the same in their local timezone.

If "browser" timezone is specified then date histograms
for periods larger that 1h will be aligned to local timezone.
@bobrik
Copy link
Author

bobrik commented Aug 29, 2013

Anyone?

@bobrik
Copy link
Author

bobrik commented Aug 29, 2013

Looks like it only works well if you rotate indices at local midnight. Not sure if this is a good idea.

@rashidkpc
Copy link
Contributor

We standardize on index rotation at UTC midnight.

@bobrik
Copy link
Author

bobrik commented Aug 29, 2013

Yep, but this way it's impossible to get date histogram aligned to midnight at local timzone.

If you fire request with aligned timezone agains many indices at once, you'll get correct results, but if you do searching day by day — things get screwed up.

For example, this is index that is rotated on midnight UTC and request isn't using pre_timezone:

{
  "took" : 305,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "failed" : 0
  },
  "hits" : {
    "total" : 44314350,
    "max_score" : 1.0,
    "hits" : [ ]
  },
  "facets" : {
    "0" : {
      "_type" : "date_histogram",
      "entries" : [ {
        "time" : 1377648000000,
        "count" : 161002,
        "min" : 1.0,
        "max" : 121016.0,
        "total" : 5.4771627E7,
        "total_count" : 161002,
        "mean" : 340.19221500354035
      } ]
    }
  }
}

The next request is using timezone correction:

{
  "took" : 193,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "failed" : 0
  },
  "hits" : {
    "total" : 44314350,
    "max_score" : 1.0,
    "hits" : [ ]
  },
  "facets" : {
    "0" : {
      "_type" : "date_histogram",
      "entries" : [ {
        "time" : 1377633600000,
        "count" : 133903,
        "min" : 1.0,
        "max" : 121016.0,
        "total" : 4.8007871E7,
        "total_count" : 133903,
        "mean" : 358.52722493148025
      }, {
        "time" : 1377720000000,
        "count" : 27099,
        "min" : 1.0,
        "max" : 93157.0,
        "total" : 6763756.0,
        "total_count" : 27099,
        "mean" : 249.59430237278127
      } ]
    }
  }
}

Here we got 2 days.

The solution I see here: add up values in kibana itself so one point could actually come from two days. It will work for count and total, mean is tricky.

Maybe I should just give up and start everything with UTC. Not sure if everybody would be happy with such solution.

What do you think?

@willejs
Copy link

willejs commented Sep 4, 2013

Everything in UTC!

@sagacity
Copy link

sagacity commented Oct 3, 2013

It would be very nice if the timepicker would also support picking dates in UTC (perhaps using a configuration setting).

@bobrik bobrik closed this Nov 3, 2013
spalger pushed a commit that referenced this pull request Oct 6, 2014
Close issue #400. Removes shadow when highlighting pie chart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants