Admin user search: include aggregations

This commit is contained in:
2018-01-05 17:03:09 +01:00
parent 67851752fa
commit 83a38ff50e
2 changed files with 6 additions and 7 deletions

View File

@@ -121,7 +121,7 @@ def do_user_search(query: str, terms: dict) -> dict:
return response.to_dict()
def do_user_search_admin(query: str) -> dict:
def do_user_search_admin(query: str, terms: dict) -> dict:
"""
return users seach result dict object
search all user fields and provide aggregation information
@@ -145,8 +145,7 @@ def do_user_search_admin(query: str) -> dict:
else:
should = []
search = Search(using=client, index=current_app.config['ELASTIC_INDICES']['USER'])
search.query = Q('bool', should=should)
search = nested_bool([], should, terms, index_alias='USER')
add_aggs_to_search(search, USER_AGG_TERMS)
if log.isEnabledFor(logging.DEBUG):