Run multiple metrics query in a batch.
This accepts a JSON document where all keys are expected to map up to a Query.
Note that the x-client-id: my_app_name
header must be supplied since anonymous requests are not permitted.
Field | Type | Purpose |
---|---|---|
*
required
|
Query
|
Queries to run. |
{
"queries": {
"a": {
"range": {"type": "relative", "unit": "HOURS", "value": 2},
"filter": ["and", ["key", "foo"], ["=", "foo", "bar"], ["+", "role"]],
"aggregation": {
"type": "group",
"of": ["site"],
"each": {
"type": "sum"
}
}
},
"b": {
"range": {"type": "relative", "unit": "HOURS", "value": 2},
"filter": ["and", ["key", "baz"], ["=", "foo", "bar"], ["+", "role"]],
"aggregation": {
"type": "group",
"of": ["site"],
"each": {
"type": "sum"
}
}
}
}
}
$ curl -XPOST -H "Content-Type: application/json"
http://localhost:8080/query/batch \
-d '{ "queries": { "a": { "range": {"type": "relative", "unit": "HOURS", "value": 2}, "filter": ["and", ["key", "foo"], ["=", "foo", "bar"], ["+", "role"]], "aggregation": { "type": "group", "of": ["site"], "each": { "type": "sum" } } }, "b": { "range": {"type": "relative", "unit": "HOURS", "value": 2}, "filter": ["and", ["key", "baz"], ["=", "foo", "bar"], ["+", "role"]], "aggregation": { "type": "group", "of": ["site"], "each": { "type": "sum" } } } } }'
Field | Type | Purpose |
---|---|---|
*
|
QueryResponse
|
Responses to each query run. |
{
"a": {
"errors": [],
"result": [
{
"hash": "deadbeef",
"tags": {"foo": "bar"},
"values": [[1300000000000, 42.0]]
},
{
"hash": "beefdead",
"tags": {"foo": "baz"},
"values": [[1300000000000, 42.0]]
}
],
"range": {
"end": 1469816790000,
"start": 1469809590000
},
"statistics": {}
},
"b": {
"errors": [],
"result": [
{
"hash": "deadbeef",
"tags": {"foo": "bar"},
"values": [[1300000000000, 42.0]]
},
{
"hash": "beefdead",
"tags": {"foo": "baz"},
"values": [[1300000000000, 42.0]]
}
],
"range": {
"end": 1469816790000,
"start": 1469809590000
},
"statistics": {}
}
}