-
Notifications
You must be signed in to change notification settings - Fork 8
Querying events
Nitish Goyal edited this page Apr 24, 2019
·
8 revisions
The query analytics is used to filter and search for events. The request supports pagination.
- opcode - query (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)
{
"opcode": "query",
"table": "test-app",
"filters": [],
"sort": {
"field": "_timestamp",
"order": "asc"
},
"from": 0,
"limit": 10
}
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"
}
]
}
{
"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": {}
}
]
}