The main difference is that timelion
on his date_histogram aggregation use extended_bounds
extended_bounds: {
min: tlConfig.time.from,
max: tlConfig.time.to
},
thats extends/force the buckets to the full range of the time:
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-histogram-aggregation.html#search-aggregations-bucket-histogram-aggregation-extended-bounds
On visualize, instead, we don't use that because the visualization itself doesn't need all the buckets to represent the data.
So for example this is a query that comes from timelion:
GET kibana_sample_data_logs/_search
{
"query": {
"bool": {
"must": [
{
"range": {
"@timestamp": {
"gte": "2019-03-30T17:32:20.691Z",
"lte": "2019-06-28T16:32:20.691Z",
"format": "strict_date_optional_time"
}
}
}
],
"filter": {
"bool": {
"must": [],
"filter": [
{
"match_all": {}
}
],
"should": [],
"must_not": []
}
}
}
},
"aggs": {
"q": {
"meta": {
"type": "split"
},
"filters": {
"filters": {
"*": {
"query_string": {
"query": "*"
}
}
}
},
"aggs": {
"geo.src": {
"meta": {
"type": "split"
},
"terms": {
"field": "geo.src",
"size": 60
},
"aggs": {
"time_buckets": {
"meta": {
"type": "time_buckets"
},
"date_histogram": {
"field": "@timestamp",
"interval": "12h",
"time_zone": "Europe/Rome",
"extended_bounds": {
"min": 1553967140691,
"max": 1561739540691
},
"min_doc_count": 0
},
"aggs": {
"sum(bytes)": {
"sum": {
"field": "bytes"
}
}
}
}
}
}
}
}
},
"size": 0
}
this will throw the ES exception I list on the previous post.
if you remove the extended_bounds
part it will return without any problem.
If you want you can issue a feature request to remove that parameter from the query: https://github.com/elastic/kibana/issues/new?template=Feature_request.md