Skip to content

Event Histogram

Rishabh edited this page Apr 7, 2015 · 5 revisions

The histogram operation gives event histogram over a given date range. Default histograms are on the _timestamp field.

Note Periods where there are zero events do not appear in the results

Parameters

  • opcode - histogram (Required) - Operation code for this analytics
  • table - table_name (Required) - Table on which analytics will be run
  • filters - Array of filters (Optional) (default - no filters)
  • field - Date field on which histogram will be calculated (Optional) (default - timestamp)
  • period - Bucketing period of response (Optional) (default - minutes) (Allowed values - seconds, minutes, hours, days)

##Request

{
    "opcode": "histogram",
    "table": "test",
    "filters": [
        {
            "field": "battery",
            "operator": "greater_than",
            "value": 48
        }
    ],
    "field": "_timestamp",
    "period": "days"
}

##Response

{
    "opcode": "histogram",
    "counts": [
        {
            "period": 1397606400000,
            "count": 4
        },
        {
            "period": 1397952000000,
            "count": 1
        },
        {
            "period": 1398643200000,
            "count": 1
        }
    ]
}