diff --git a/es_search.py b/es_search.py index 237af6a..7f3402f 100644 --- a/es_search.py +++ b/es_search.py @@ -25,9 +25,9 @@ class ESSearch(PyOperator): super().__init__() try: self.client = Elasticsearch( - f'https://{host}:{port}', + f'http://{host}:{port}' if not ca_certs else f'https://{host}:{port}', ca_certs=ca_certs, - basic_auth=(user, password)) + basic_auth=(user, password) if user and password else None) logger.info('Successfully connected to ElasticSearch client.') except Exception as e: logger.error('Failed to connect ElasticSearch client:\n', e) @@ -35,7 +35,7 @@ class ESSearch(PyOperator): def __call__(self, index_name: str, query: dict = {'match_all': {}}, enable: bool=True): if not enable: - return None + return '' resp = self.client.search(index=index_name, query=query) return resp