Skip to content

Querying events

Rishabh edited this page Apr 7, 2015 · 8 revisions

The query analytics is used to filter and search for events. The request supports pagination.

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)
  • sort - Field on which output will be sorted (Optional) (default: _timestamp, order - descending)
  • from - Starting record number (default: 0)
  • to - Number of records to fetch (default: 10)

Sample Request

{
    "opcode": "query",
    "table": "test-app",
    "filters": [],
    "sort": {
        "field": "_timestamp",
        "order": "asc"
    },
    "from": 0,
    "limit": 10
}

Sample Request (With Filter)

The following will fetch first ten events with field "os" not being equal to "ios", sort it in latest first (descending) order on time at which it came into the system (_timestamp field).

{
    "opcode": "query",
    "table": "test-app",
    "filters": [
        {
            "operator": "not_equals",
            "field": "os",
            "value": "ios"
        }
    ]
}

Sample Response

{
    "opcode": "query",
    "documents": [
        {
            "id": "255c08c8-3b21-4acb-89c9-0dc834647b56",
            "timestamp": 1401445491709,
            "data": {}
        },
        {
            "id": "4d3a4529-6c90-4f41-9664-d06f53738fde",
            "timestamp": 1401445491709,
            "data": {}
        },
        {
            "id": "bc36d174-eeaa-4413-ae12-ed21646b8655",
            "timestamp": 1401445491709,
            "data": {}
        }
    ]
}