GET posts/_search
{
"size": 0,
"aggs": {
"hashtags": {
"terms": {
"field": "hashtags",
"size": 10
},
"aggs": {
"tagalongs": {
"terms": {
"field": "hashtags",
"size": 10
}
}
}
}
}
}
With this query you get results with the same key as the top result. Like the following example.
"aggregations" : {
"hashtags" : {
"doc_count_error_upper_bound" : 1991,
"sum_other_doc_count" : 865940,
"buckets" : [
{
"key" : "love",
"doc_count" : 12542,
"tagalongs" : {
"doc_count_error_upper_bound" : 973,
"sum_other_doc_count" : 264137,
"buckets" : [
{
"key" : "love",
"doc_count" : 12542
},
Is there an easy and performant way to exclude the key of the parent?