Skip to content

Commit

Permalink
add doc comment
Browse files Browse the repository at this point in the history
Signed-off-by: Luka Peschke <luka.peschke@toucantoco.com>
  • Loading branch information
lukapeschke committed Jan 23, 2024
1 parent 7a3636c commit c72bfcd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions toucan_connectors/elasticsearch/elasticsearch_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,13 @@ def _retrieve_data(self, data_source: ElasticsearchDataSource) -> pd.DataFrame:
connection_params.append(h)

esclient = Elasticsearch(connection_params)
# We need to set this flag as some customers force auth and refuse the connection if no auth
# header is present. Elasticsearch-py accepts 401/403s
# (https://github.com/elastic/elasticsearch-py/blob/v7.17.6/elasticsearch/transport.py#L586),
# but not connection errors. In consequence, we set the flag to True, which means that we
# couldn't figure out wether we are talking to Elasticsearch or not due to an auth error:
# https://github.com/elastic/elasticsearch-py/blob/v7.17.6/elasticsearch/transport.py#L216.
# If we are indded not talking to Elasticsearch, the query will fail later on.
esclient.transport._verified_elasticsearch = True
response = getattr(esclient, data_source.search_method)(
index=data_source.index, body=data_source.body
Expand Down

0 comments on commit c72bfcd

Please sign in to comment.