Is there a way to prevent the buckets
array from being returned as a part of the aggregation result? I am using a sum_bucket
to total all of the buckets and I don't need all of the buckets to be returned. I'm just using key
and displayCount
. I worry that with my dataset, there could be hundreds of buckets returned for hundreds of keys.
Meaning, if my default result is below:
{
"aggregations" : {
"Sports" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [
{
"key" : "Football",
"doc_count" : 5,
"States" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [
{
"key" : "Maryland",
"doc_count" : 1,
"countStates" : {
"value" : 1
}
},
{
"key" : "New York",
"doc_count" : 1,
"countStates" : {
"value" : 1
}
},
{
"key" : "Ohio",
"doc_count" : 1,
"countStates" : {
"value" : 1
}
},
{
"key" : "Pennsylvania",
"doc_count" : 1,
"countStates" : {
"value" : 1
}
},
{
"key" : "Virginia",
"doc_count" : 1,
"countStates" : {
"value" : 1
}
}
]
},
"displayCount" : {
"value" : 5.0
}
},
{
"key" : "Baseball",
"doc_count" : 3,
"States" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [
{
"key" : "Maryland",
"doc_count" : 1,
"countStates" : {
"value" : 1
}
},
{
"key" : "Ohio",
"doc_count" : 1,
"countStates" : {
"value" : 1
}
},
{
"key" : "Pennsylvania",
"doc_count" : 1,
"countStates" : {
"value" : 1
}
}
]
},
"displayCount" : {
"value" : 3.0
}
}
}
}
Can I remove the buckets
array within the fields to only return the following:
{
"aggregations" : {
"Sports" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [
{
"key" : "Football",
"doc_count" : 5,
"States" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0
}
"displayCount" : {
"value" : 5.0
}
},
{
"key" : "Baseball",
"doc_count" : 3,
"States" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
},
"displayCount" : {
"value" : 3.0
}
}
}
}