Check the specified window
This commit is contained in:
@@ -256,6 +256,16 @@ class ElasticsearchBackend(StorageBackend):
|
||||
search_query = self.parse_query(
|
||||
data, tags, None, False, add_bool, bypass_check=True
|
||||
)
|
||||
if rule_object.window is not None:
|
||||
range_query = {
|
||||
"range": {
|
||||
"ts": {
|
||||
"gt": f"now-{rule_object.window}/d",
|
||||
"lt": "now/d",
|
||||
}
|
||||
}
|
||||
}
|
||||
add_top.append(range_query)
|
||||
self.add_bool(search_query, add_bool)
|
||||
self.add_top(search_query, add_top)
|
||||
if "sentiment" in data:
|
||||
|
||||
Reference in New Issue
Block a user