Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 26 additions & 12 deletions doc/queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,17 @@
</td>
</tr>
<tr>
<td colspan="2">Three possible aggregations available: top-level aggregation - only total number; text aggregation - buckets for key and count for that key; numeric aggregation - minimum, maximum, average, sum and count for the whole dataset and for the buckets specified by <code>rangestep</code>. Without <code>rangestep</code> it aggregates the whole dataset.</td>
<td colspan="2">Three possible aggregations available:
<li>
top-level aggregation - only total number;
</li>
<li>
text aggregation - histogram for key and count for that key;
</li>
<li>
numeric aggregation - minimum, maximum, average, sum and count for the whole dataset and for the histogram specified by <code>rangeStep</code>, <code>rangeStart</code> (default to min), and <code>rangeEnd</code> (default to max). Without <code>rangeStep</code> it aggregates the whole dataset.
</li>
</td>
</tr>
<tr>
<td>
Expand All @@ -70,13 +80,13 @@
total
}
gender {
buckets {
histogram {
key
count
}
}
age {
buckets(rangestep: 5) {
histogram(rangeStart: 0, rangeEnd: 40, rangeStep: 5) {
_range
min
max
Expand All @@ -97,7 +107,7 @@
"total": 3
},
"gender": {
"buckets": [
"histogram": [
{
"key": "F",
"count": 10
Expand All @@ -109,15 +119,16 @@
]
},
"age": {
"buckets": [
"histogram": [
{
"_range": [0, 5],
"min": 2
},
{
"_range": [5, 10],
"min": 3
}
},
...
]
}
}
Expand All @@ -131,7 +142,7 @@
{
aggs(filter: $filter) {
age {
buckets {
histogram {
min
max
avg
Expand All @@ -148,7 +159,7 @@
{
"aggs": {
"age": {
"buckets": [
"histogram": [
{
"min": 2,
"max": 10,
Expand All @@ -170,10 +181,6 @@

There is a discussion of two approaches:

* `SQL`-like syntax
```
{"filter": "Gender = "F" AND ((Age >= 27 OR Age = 15) AND _samples_count > 12)"}
```
* `JSON`-based syntax
```
{
Expand All @@ -197,4 +204,11 @@ There is a discussion of two approaches:
}
```

* `SQL`-like syntax
```
{"filter": "Gender = "F" AND ((Age >= 27 OR Age = 15) AND _samples_count > 12)"}
```
The implementation is relatively more difficult (to parse SQL string to object). But in future we want to support having a SQL-like syntax query in UI, so it is very rewarding.


## Discussion