Update reverse-nested-aggregation.asciidoc

Fixed reverse nested example

Closes #7463
This commit is contained in:
Clinton Gormley 2014-09-02 11:40:28 +01:00
parent df5d22c7d7
commit a059a6574a
1 changed files with 47 additions and 44 deletions

View File

@ -45,34 +45,37 @@ tags that issues have the commenter has commented to:
[source,js]
--------------------------------------------------
{
"query" : {
"match" : { "name" : "led tv" }
"query": {
"match": {
"name": "led tv"
}
"aggs" : {
"comments" : {
"nested" : {
"path" : "comments"
},
"aggs" : {
"top_usernames" : {
"terms" : {
"field" : "comments.username"
}
},
"aggs" : {
"comment_to_issue" : {
"reverse_nested" : { <1>
},
"aggs" : {
"top_tags_per_comment" : {
"terms" : { "field" : "tags" }
}
}
}
},
"aggs": {
"comments": {
"nested": {
"path": "comments"
},
"aggs": {
"top_usernames": {
"terms": {
"field": "comments.username"
},
"aggs": {
"comment_to_issue": {
"reverse_nested": {}, <1>
"aggs": {
"top_tags_per_comment": {
"terms": {
"field": "tags"
}
}
}
}
}
}
}
}
}
}
--------------------------------------------------
@ -89,29 +92,29 @@ Possible response snippet:
[source,js]
--------------------------------------------------
{
"aggregations": {
"comments": {
"top_usernames": {
"buckets" : [
{
"key" : "username_1",
"doc_count" : 12,
"comment_to_issue" : {
"top_tags_per_comment" : {
"buckets" : [
{
"key" : "tag1",
"doc_count" : 9
},
...
]
}
},
...
}
"aggregations": {
"comments": {
"top_usernames": {
"buckets": [
{
"key": "username_1",
"doc_count": 12,
"comment_to_issue": {
"top_tags_per_comment": {
"buckets": [
{
"key": "tag1",
"doc_count": 9
},
...
]
}
}
}
},
...
]
}
}
}
}
--------------------------------------------------