我正在使用 elasticsearch 开放发行版来创建警报系统。但是我的弹性搜索查询有一个问题:
"search": {
"indices": ["test_alert"],
"query": {
"size": 3,
"aggregations": {},
"query": {
"bool": {
"filter": {
"range": {
"@timestamp": {
"gte": "now-1h",
"lte": "now",
"format": "epoch_second"
}
}
}
}
}
}
}
这是我在我的开放发行版监视器中使用的查询。问题是now-1h
似乎不起作用,我总是得到一个空的结果。我尝试使用原始时间戳(为了匹配并获得结果)并且效果很好。我不明白为什么在我使用now-1h
.
这是我的映射:
properties": {
"timestamp": {
"type": "date",
"format": "epoch_second"
},
"value": {
"type": "long"
}
}
谢谢你的帮助 !