Skip to content

Commit

Permalink
Made all multi-bucket aggs return consistent response format
Browse files Browse the repository at this point in the history
Closes #4926
  • Loading branch information
uboness committed Jan 28, 2014
1 parent d691649 commit 1596a27
Show file tree
Hide file tree
Showing 9 changed files with 240 additions and 214 deletions.
Expand Up @@ -111,19 +111,21 @@ Response:
--------------------------------------------------
{
"aggregations": {
"articles_over_time": [
{
"key_as_string": "2013-02-02",
"key": 1328140800000,
"doc_count": 1
},
{
"key_as_string": "2013-03-02",
"key": 1330646400000,
"doc_count": 2
},
...
]
"articles_over_time": {
"buckets": [
{
"key_as_string": "2013-02-02",
"key": 1328140800000,
"doc_count": 1
},
{
"key_as_string": "2013-03-02",
"key": 1330646400000,
"doc_count": 2
},
...
]
}
}
}
--------------------------------------------------
Expand Down
Expand Up @@ -34,18 +34,20 @@ Response:
...
"aggregations": {
"range": [
{
"to": 1.3437792E+12,
"to_as_string": "08-2012",
"doc_count": 7
},
{
"from": 1.3437792E+12,
"from_as_string": "08-2012",
"doc_count": 2
}
]
"range": {
"buckets": [
{
"to": 1.3437792E+12,
"to_as_string": "08-2012",
"doc_count": 7
},
{
"from": 1.3437792E+12,
"from_as_string": "08-2012",
"doc_count": 2
}
]
}
}
}
--------------------------------------------------
Expand Down
Expand Up @@ -28,24 +28,26 @@ Response:
--------------------------------------------------
{
"aggregations": {
"rings": [
{
"unit": "km",
"to": 100.0,
"doc_count": 3
},
{
"unit": "km",
"from": 100.0,
"to": 300.0,
"doc_count": 1
},
{
"unit": "km",
"from": 300.0,
"doc_count": 7
}
]
"rings" : {
"buckets": [
{
"unit": "km",
"to": 100.0,
"doc_count": 3
},
{
"unit": "km",
"from": 100.0,
"to": 300.0,
"doc_count": 1
},
{
"unit": "km",
"from": 300.0,
"doc_count": 7
}
]
}
}
}
--------------------------------------------------
Expand Down
Expand Up @@ -34,20 +34,22 @@ And the following may be the response:
--------------------------------------------------
{
"aggregations": {
"prices": [
{
"key": 0,
"doc_count": 2
},
{
"key": 50,
"doc_count": 4
},
{
"key": 150,
"doc_count": 3
}
]
"prices" : {
"buckets": [
{
"key": 0,
"doc_count": 2
},
{
"key": 50,
"doc_count": 4
},
{
"key": 150,
"doc_count": 3
}
]
}
}
}
--------------------------------------------------
Expand Down Expand Up @@ -75,24 +77,26 @@ Response:
--------------------------------------------------
{
"aggregations": {
"prices": [
{
"key": 0,
"doc_count": 2
},
{
"key": 50,
"doc_count": 4
},
{
"key" : 100,
"doc_count" : 0
},
{
"key": 150,
"doc_count": 3
}
]
"prices" : {
"buckets": [
{
"key": 0,
"doc_count": 2
},
{
"key": 50,
"doc_count": 4
},
{
"key" : 100,
"doc_count" : 0
},
{
"key": 150,
"doc_count": 3
}
]
}
}
}
--------------------------------------------------
Expand Down Expand Up @@ -187,29 +191,31 @@ NOTE: The special value `0` can be used to add empty buckets to the response b
{
"aggregations": {
"prices": {
"0": {
"key": 0,
"doc_count": 2
},
"50": {
"key": 50,
"doc_count": 0
},
"150": {
"key": 150,
"doc_count": 3
},
"200": {
"key": 150,
"doc_count": 0
},
"250": {
"key": 150,
"doc_count": 0
},
"300": {
"key": 150,
"doc_count": 1
"buckets": {
"0": {
"key": 0,
"doc_count": 2
},
"50": {
"key": 50,
"doc_count": 0
},
"150": {
"key": 150,
"doc_count": 3
},
"200": {
"key": 150,
"doc_count": 0
},
"250": {
"key": 150,
"doc_count": 0
},
"300": {
"key": 150,
"doc_count": 1
}
}
}
}
Expand Down Expand Up @@ -242,19 +248,21 @@ Response:
{
"aggregations": {
"prices": {
"0": {
"key": 0,
"doc_count": 2
},
"50": {
"key": 50,
"doc_count": 4
},
"150": {
"key": 150,
"doc_count": 3
"buckets": {
"0": {
"key": 0,
"doc_count": 2
},
"50": {
"key": 50,
"doc_count": 4
},
"150": {
"key": 150,
"doc_count": 3
}
}
}
}
}
}
--------------------------------------------------
Expand Up @@ -30,18 +30,20 @@ Response:
...
"aggregations": {
"ip_ranges": [
{
"to": 167772165,
"to_as_string": "10.0.0.5",
"doc_count": 4
},
{
"from": 167772165,
"from_as_string": "10.0.0.5",
"doc_count": 6
}
]
"ip_ranges":
"buckets" : [
{
"to": 167772165,
"to_as_string": "10.0.0.5",
"doc_count": 4
},
{
"from": 167772165,
"from_as_string": "10.0.0.5",
"doc_count": 6
}
]
}
}
}
--------------------------------------------------
Expand Down Expand Up @@ -71,24 +73,26 @@ Response:
--------------------------------------------------
{
"aggregations": {
"ip_ranges": [
{
"key": "10.0.0.0/25",
"from": 1.6777216E+8,
"from_as_string": "10.0.0.0",
"to": 167772287,
"to_as_string": "10.0.0.127",
"doc_count": 127
},
{
"key": "10.0.0.127/25",
"from": 1.6777216E+8,
"from_as_string": "10.0.0.0",
"to": 167772287,
"to_as_string": "10.0.0.127",
"doc_count": 127
}
]
"ip_ranges": {
"buckets": [
{
"key": "10.0.0.0/25",
"from": 1.6777216E+8,
"from_as_string": "10.0.0.0",
"to": 167772287,
"to_as_string": "10.0.0.127",
"doc_count": 127
},
{
"key": "10.0.0.127/25",
"from": 1.6777216E+8,
"from_as_string": "10.0.0.0",
"to": 167772287,
"to_as_string": "10.0.0.127",
"doc_count": 127
}
]
}
}
}
--------------------------------------------------

0 comments on commit 1596a27

Please sign in to comment.