Kibana: 6.2.5
Metric Type: Sum, the response return value '0' for the empty buckets.
Metric Type: Min/Max/Average, the response return value 'null' for the empty buckets.
Below the request and response:
Request:
{
"size": 0,
"_source": {
"excludes":
},
"aggs": {
"2": {
"terms": {
"field": "x_coord",
"size": 50,
"order": {
"_term": "desc"
}
},
"aggs": {
"3": {
"histogram": {
"field": "y_coord",
"interval": 1,
"min_doc_count": 0,
"extended_bounds": {
"min": 1,
"max": 22
}
},
"aggs": {
"1": {
"sum": {
"field": "Fcnt"
}
}
}
}
}
}
},
"stored_fields": [
"*"
],
"script_fields": {},
"docvalue_fields": ,
"query": {
"bool": {
"must": [
{
"match_all": {}
}
],
"filter": ,
"should": ,
"must_not":
}
}
}
And the response like:
{
"took": 8,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 246,
"max_score": 0,
"hits": []
},
"aggregations": {
"2": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"3": {
"buckets": [
{
"1": {
**"value": 0**
},
"key": 1,
"doc_count": 0
},
{
"1": {
**"value": 0**
},
"key": 2,
"doc_count": 0
},
{
"1": {
**"value": 0**
},
...
...
But while the Metric Type to "Min"
Request:
{
"size": 0,
"_source": {
"excludes":
},
"aggs": {
"2": {
"terms": {
"field": "x_coord",
"size": 50,
"order": {
"_term": "desc"
}
},
"aggs": {
"3": {
"histogram": {
"field": "y_coord",
"interval": 1,
"min_doc_count": 0,
"extended_bounds": {
"min": 1,
"max": 22
}
},
"aggs": {
"1": {
"min": {
"field": "Fcnt"
}
}
}
}
}
}
},
"stored_fields": [
"*"
],
"script_fields": {},
"docvalue_fields": ,
"query": {
"bool": {
"must": [
{
"match_all": {}
}
],
"filter": ,
"should": ,
"must_not":
}
}
}
And the response:
> {
"took": 8, "timed_out": false, "_shards": { "total": 5, "successful": 5, "skipped": 0, "failed": 0 }, "hits": { "total": 246, "max_score": 0, "hits": [] }, "aggregations": { "2": { "doc_count_error_upper_bound": 0, "sum_other_doc_count": 0, "buckets": [ { "3": { "buckets": [ { "1": { **"value": null** }, "key": 1, "doc_count": 0 }, { "1": { **"value": null** }, "key": 2, "doc_count": 0 }, .... ....
this two kinds of empty results:
value '0' mixed with the none empty bucket value '0', right? now while using the histogram, the empty bucket data just mix with the valid value '0' with 'sum' type metric.
but if value 'null', we know that this is from the empty bucket and would not mix with the none empty bucket data.