Reformat OpenSearch

This commit is contained in:
Mark Veidemanis 2022-07-21 13:47:10 +01:00
parent 7c53e0ec9d
commit d0ecc92169
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 5 additions and 2 deletions

View File

@ -5,6 +5,7 @@ from opensearchpy import OpenSearch
def initialise_opensearch(): def initialise_opensearch():
auth = (settings.OPENSEARCH_USERNAME, settings.OPENSEARCH_PASSWORD) auth = (settings.OPENSEARCH_USERNAME, settings.OPENSEARCH_PASSWORD)
client = OpenSearch( client = OpenSearch(
# fmt: off
hosts=[{"host": settings.OPENSEARCH_URL, hosts=[{"host": settings.OPENSEARCH_URL,
"port": settings.OPENSEARCH_PORT}], "port": settings.OPENSEARCH_PORT}],
http_compress=False, # enables gzip compression for request bodies http_compress=False, # enables gzip compression for request bodies
@ -35,5 +36,7 @@ def construct_query(query):
def run_main_query(client, query): def run_main_query(client, query):
search_query = construct_query(query) search_query = construct_query(query)
response = client.search(body=search_query, index=settings.OPENSEARCH_INDEX_MAIN) # fmt: off
response = client.search(body=search_query,
index=settings.OPENSEARCH_INDEX_MAIN)
return response return response