hourOfWeek aggregation attempt results do not match date histogram by hour aggregation


(Dustin Decker) #1

I'm trying to replicate the results of this data histogram aggregation but bucket by hour of week (0 through 168) instead:

"dateByHour": {
      "date_histogram": {
        "field": "event_timestamp",
        "interval": "1h",
        "time_zone": "America/Chicago",
        "min_doc_count": 1
      }
 }

My attempt is delivering similar results for some hours, and results about 5x off for others:

"hourOfWeek": {
    "terms": {
        "script": {
            "lang": "painless",
            "inline": "doc['event_timestamp'].date.dayOfWeek * doc['event_timestamp'].date.hourOfDay"
        },
        "size": 168
    }
}

Any ideas of what I may be doing incorrectly?


(system) #2

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