Skip to content
This repository has been archived by the owner on Jan 7, 2021. It is now read-only.

Commit

Permalink
Fixed sample format/result of dateRange aggregation. Fixed format of …
Browse files Browse the repository at this point in the history
…Json samples (#111)

(cherry picked from commit f9ae994)
  • Loading branch information
alansemenov committed Oct 8, 2018
1 parent 74966f9 commit f3e3bb2
Show file tree
Hide file tree
Showing 13 changed files with 218 additions and 161 deletions.
16 changes: 9 additions & 7 deletions doc/developer/search/aggregations/code/date-histogram-query.json
@@ -1,8 +1,10 @@
"by_month": {
"dateHistogram": {
"field": "init_date",
"interval": "1M",
"minDocCount": 0,
"format": "MM-yyy"
{
"by_month": {
"dateHistogram": {
"field": "init_date",
"interval": "1M",
"minDocCount": 0,
"format": "MM-yyy"
}
}
}
}
30 changes: 18 additions & 12 deletions doc/developer/search/aggregations/code/date-histogram-result.json
@@ -1,12 +1,18 @@
"by_month" : {
"buckets" : [{
"docCount" : 8,
"key" : "2014-01"
}, {
"docCount" : 10,
"key" : "2014-02"
}, {
"docCount" : 12,
"key" : "2014-03"
}]
}
{
"by_month": {
"buckets": [
{
"docCount": 8,
"key": "2014-01"
},
{
"docCount": 10,
"key": "2014-02"
},
{
"docCount": 12,
"key": "2014-03"
}
]
}
}
26 changes: 15 additions & 11 deletions doc/developer/search/aggregations/code/date-range-query.json
@@ -1,12 +1,16 @@
"my_date_range": {
"dateRange": {
"field": "date",
"format": "MM-yyy",
"ranges": [{
"to": "now-10M"
},
{
"from": "now-10M"
}]
{
"my_date_range": {
"dateRange": {
"field": "date",
"format": "MM-yyy",
"ranges": [
{
"to": "now-10M"
},
{
"from": "now-10M"
}
]
}
}
}
}
32 changes: 15 additions & 17 deletions doc/developer/search/aggregations/code/date-range-result.json
@@ -1,18 +1,16 @@
"price_ranges": {
"buckets": [{
"docCount": 2,
"key": "a",
"to": 50
},
{
"docCount": 4,
"from": 50,
"key": "b",
"to": 100
},
{
"docCount": 4,
"from": 100,
"key": "c"
}]
{
"my_date_range": {
"buckets": [
{
"key": "*-12-2017",
"docCount": 2,
"to": "2017-12-01T00:00:00Z"
},
{
"key": "12-2017-*",
"docCount": 4,
"from": "2017-12-01T00:00:00Z"
}
]
}
}
1 change: 1 addition & 0 deletions doc/developer/search/aggregations/code/expr.json
@@ -1,3 +1,4 @@
{
"aggregations" : {
"[name]" : {
"[type]" : {
Expand Down
40 changes: 29 additions & 11 deletions doc/developer/search/aggregations/code/geo-distance-query.json
@@ -1,13 +1,31 @@
"aggregations": {
{
"aggregations": {
"distance": {
"geoDistance": {
'field': "data.cityLocation",
'unit': "km",
'origin': {
'lat': "90.0",
'lon': "0.0"
},
'ranges': [ { 'from': 0, 'to': 1200 }, { 'from': 1200, 'to': 4000 }, { 'from': 4000, 'to': 12000 }, {'from': 12000} ]
}
"geoDistance": {
"field": "data.cityLocation",
"unit": "km",
"origin": {
"lat": "90.0",
"lon": "0.0"
},
"ranges": [
{
"from": 0,
"to": 1200
},
{
"from": 1200,
"to": 4000
},
{
"from": 4000,
"to": 12000
},
{
"from": 12000
}
]
}
}
}
}
}
41 changes: 23 additions & 18 deletions doc/developer/search/aggregations/code/geo-distance-result.json
@@ -1,19 +1,24 @@
"aggregations":
{"distance":
{"buckets": [{
"key": "*-1200.0",
"doc_count": 3,
},
{
"key": "1200.0-4000.0",
"doc_count": 4,
},
{
"key": "4000.0-12000.0",
"doc_count": 5,
},
{
"key": "12000.0-*",
"doc_count": 1,
},],},
{
"aggregations": {
"distance": {
"buckets": [
{
"key": "*-1200.0",
"doc_count": 3
},
{
"key": "1200.0-4000.0",
"doc_count": 4
},
{
"key": "4000.0-12000.0",
"doc_count": 5
},
{
"key": "12000.0-*",
"doc_count": 1
}
]
}
}
}
27 changes: 18 additions & 9 deletions doc/developer/search/aggregations/code/range-query.json
@@ -1,10 +1,19 @@
"price_ranges": {
"range": {
"field": "price",
"ranges": [
{ "to": 50 },
{ "from": 50, "to": 100 },
{ "from": 100 }
]
{
"price_ranges": {
"range": {
"field": "price",
"ranges": [
{
"to": 50
},
{
"from": 50,
"to": 100
},
{
"from": 100
}
]
}
}
}
}
40 changes: 22 additions & 18 deletions doc/developer/search/aggregations/code/range-result.json
@@ -1,18 +1,22 @@
"price_ranges": {
"buckets": [{
"docCount": 2,
"key": "a",
"to": 50
},
{
"docCount": 4,
"from": 50,
"key": "b",
"to": 100
},
{
"docCount": 4,
"from": 100,
"key": "c"
}]
}
{
"price_ranges": {
"buckets": [
{
"docCount": 2,
"key": "a",
"to": 50
},
{
"docCount": 4,
"from": 50,
"key": "b",
"to": 100
},
{
"docCount": 4,
"from": 100,
"key": "c"
}
]
}
}
74 changes: 39 additions & 35 deletions doc/developer/search/aggregations/code/stats-result.json
@@ -1,35 +1,39 @@
"products": {
"buckets": [{
"key": "tv",
"docCount": 123,
"priceStats": {
"count": 123,
"min": 2599,
"max": 87944,
"avg": 7400,
"sum": 578100
}
},
{
"key": "blu-ray player",
"docCount": 42,
"priceStats": {
"count": 42,
"min": 699,
"max": 5999,
"avg": 1548,
"sum": 65016
}
},
{
"key": "reciever",
"docCount": 12,
"priceStats": {
"count": 12,
"min": 2999,
"max": 26950,
"avg": 5548,
"sum": 66756
}
}]
}
{
"products": {
"buckets": [
{
"key": "tv",
"docCount": 123,
"priceStats": {
"count": 123,
"min": 2599,
"max": 87944,
"avg": 7400,
"sum": 578100
}
},
{
"key": "blu-ray player",
"docCount": 42,
"priceStats": {
"count": 42,
"min": 699,
"max": 5999,
"avg": 1548,
"sum": 65016
}
},
{
"key": "reciever",
"docCount": 12,
"priceStats": {
"count": 12,
"min": 2999,
"max": 26950,
"avg": 5548,
"sum": 66756
}
}
]
}
}
16 changes: 9 additions & 7 deletions doc/developer/search/aggregations/code/terms-query.json
@@ -1,9 +1,11 @@
"aggregations": {
"categories": {
"terms": {
"field": "myCategory",
"order": "_count desc",
"size": 10
{
"aggregations": {
"categories": {
"terms": {
"field": "myCategory",
"order": "_count desc",
"size": 10
}
}
}
}
}

0 comments on commit f3e3bb2

Please sign in to comment.