minor documentation / annotation fixes

This commit is contained in:
2018-01-05 11:58:33 +01:00
parent 2ed2aaf58f
commit 2433a1b981
4 changed files with 16 additions and 12 deletions

View File

@@ -1,7 +1,8 @@
import json
import logging
from elasticsearch import Elasticsearch
from elasticsearch_dsl import Search, Q
import logging
from pillar import current_app
log = logging.getLogger(__name__)
@@ -12,7 +13,9 @@ user_agg_terms = ['roles', ]
class TheELKClient():
"""
current_app is not available when on import
Elastic-client singleton.
`current_app` is not available when on import
"""
client: Elasticsearch = None
@@ -23,6 +26,7 @@ class TheELKClient():
else:
return self.client
elk = TheELKClient()
@@ -89,6 +93,7 @@ def do_search(query: str, terms: dict) -> dict:
add_aggs_to_search(search, node_agg_terms)
if log.isEnabledFor(logging.DEBUG):
# logging removes readable indendation.
print(json.dumps(search.to_dict(), indent=4))
response = search.execute()