有没有办法将date_histogram存储桶偏移当前秒数?
这是我正在处理的汇总:
query = {
"size": 0,
"aggs": {
"time_buckets": {
"date_histogram": {
"field": "@timestamp",
"interval": "1m",
"min_doc_count": 0,
"offset": "+now.getSeconds()", # <-- how?
"extended_bounds": { "min": "now-1m", "max": "now" }
}
}
},
"query": {
"range": { "@timestamp": {"gte": "now-1m", "lt": "now"} }
}
}
我基本上是在尝试修改Trend Indicator示例以摆脱排除最后一分钟的限制。应该返回2个存储桶:最近的60s,以及之前的60s。
我还尝试使用秒/毫秒而不是分钟(间隔:60s和60000ms)工作,以为也许它不再能取整了,但是我错了!