This repository has been archived by the owner on Jan 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed sample format/result of dateRange aggregation. Fixed format of …
- Loading branch information
1 parent
74966f9
commit f3e3bb2
Showing
13 changed files
with
218 additions
and
161 deletions.
There are no files selected for viewing
16 changes: 9 additions & 7 deletions
16
doc/developer/search/aggregations/code/date-histogram-query.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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
30
doc/developer/search/aggregations/code/date-histogram-result.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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
26
doc/developer/search/aggregations/code/date-range-query.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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
32
doc/developer/search/aggregations/code/date-range-result.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
{ | ||
"aggregations" : { | ||
"[name]" : { | ||
"[type]" : { | ||
|
40 changes: 29 additions & 11 deletions
40
doc/developer/search/aggregations/code/geo-distance-query.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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
41
doc/developer/search/aggregations/code/geo-distance-result.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
"aggregations": { | ||
"categories": { | ||
"terms": { | ||
"field": "myCategory", | ||
"order": "_count desc", | ||
"size": 10 | ||
{ | ||
"aggregations": { | ||
"categories": { | ||
"terms": { | ||
"field": "myCategory", | ||
"order": "_count desc", | ||
"size": 10 | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.