Fix policies not triggering properly

This commit is contained in:
2023-02-09 20:28:34 +00:00
parent 7b6da7b704
commit 9519c1ac9f
4 changed files with 28 additions and 29 deletions

View File

@@ -272,12 +272,10 @@ class ElasticsearchBackend(StorageBackend):
"""
if self.async_client is None:
await self.async_initialise()
print("MATCHES", matches)
for match in matches:
result = await self.async_client.index(
index=settings.INDEX_RULE_STORAGE, body=match
)
print("RESULT", result)
if not result["result"] == "created":
self.log.error(f"Indexing failed: {result}")
self.log.debug(f"Indexed {len(matches)} messages in ES")
@@ -527,7 +525,6 @@ class ElasticsearchBackend(StorageBackend):
total_sources = (
len(settings.MAIN_SOURCES) - 1 + len(settings.SOURCES_RESTRICTED)
)
print("total_count", total_count, "total_sources", total_sources)
if total_count != total_sources:
add_top_tmp = {"bool": {"should": []}}
for source_iter in sources:
@@ -607,7 +604,6 @@ class ElasticsearchBackend(StorageBackend):
search_query,
index=index,
)
print("query", search_query)
if "message" in response:
return response