From 06a76805441099ff085fbc7acc39e7bdfb3e6431 Mon Sep 17 00:00:00 2001 From: Qingya Shu Date: Fri, 1 Mar 2019 16:10:46 -0600 Subject: [PATCH 1/2] fix(queries): update some places --- doc/queries.md | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/doc/queries.md b/doc/queries.md index 38b32c1f..ea773057 100644 --- a/doc/queries.md +++ b/doc/queries.md @@ -70,13 +70,13 @@ total } gender { - buckets { + histogram { key count } } age { - buckets(rangestep: 5) { + histogram(rangeStart: 0, rangeEnd: 40, rangeStep: 5) { _range min max @@ -97,7 +97,7 @@ "total": 3 }, "gender": { - "buckets": [ + "histogram": [ { "key": "F", "count": 10 @@ -109,7 +109,7 @@ ] }, "age": { - "buckets": [ + "histogram": [ { "_range": [0, 5], "min": 2 @@ -117,7 +117,8 @@ { "_range": [5, 10], "min": 3 - } + }, + ... ] } } @@ -170,10 +171,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 ``` { @@ -197,4 +194,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 From 993937392c47ac98e987791515196d4d6f1af310 Mon Sep 17 00:00:00 2001 From: Qingya Shu Date: Fri, 1 Mar 2019 16:17:26 -0600 Subject: [PATCH 2/2] fix(histogram): more --- doc/queries.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/doc/queries.md b/doc/queries.md index ea773057..22281d2c 100644 --- a/doc/queries.md +++ b/doc/queries.md @@ -59,7 +59,17 @@ -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 rangestep. Without rangestep it aggregates the whole dataset. +Three possible aggregations available: +
  • + top-level aggregation - only total number; +
  • +
  • + text aggregation - histogram for key and count for that key; +
  • +
  • + numeric aggregation - minimum, maximum, average, sum and count for the whole dataset and for the histogram specified by rangeStep, rangeStart (default to min), and rangeEnd (default to max). Without rangeStep it aggregates the whole dataset. +
  • + @@ -132,7 +142,7 @@ { aggs(filter: $filter) { age { - buckets { + histogram { min max avg @@ -149,7 +159,7 @@ { "aggs": { "age": { - "buckets": [ + "histogram": [ { "min": 2, "max": 10,