-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_elasticsearch.py
More file actions
37 lines (30 loc) · 1.07 KB
/
Copy pathtest_elasticsearch.py
File metadata and controls
37 lines (30 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from Integrations.elasticsearch_client import SimpleElasticsearchClient
import json
def test_elasticsearch_integration():
print("=== Testing Elasticsearch Integration ===")
# Initialize client
client = SimpleElasticsearchClient()
# Test connection
if client.test_connection():
print("Connection successful")
else:
print("Connection failed")
return
# Test queries
test_queries = [
"Show me failed login attempts",
"Find critical severity events",
"List authentication events",
"Get recent security events"
]
for query in test_queries:
print(f"\n--- Testing: '{query}' ---")
result = client.execute_security_query(query)
if result["success"]:
print(f"Found {result['total_hits']} results")
if result["results"]:
print(f"Sample result: {json.dumps(result['results'][0], indent=2)}")
else:
print(f"Error: {result['error']}")
if __name__ == "__main__":
test_elasticsearch_integration()