mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-22 14:49:29 +00:00
community[patch]: ElasticsearchStore: preserve user headers (#16830)
Users can provide an Elasticsearch connection with custom headers. This PR makes sure these headers are preserved when adding the langchain user agent header.
This commit is contained in:
parent
112e10e933
commit
ab3d944667
@ -528,9 +528,9 @@ class ElasticsearchStore(VectorStore):
|
|||||||
self.strategy = strategy
|
self.strategy = strategy
|
||||||
|
|
||||||
if es_connection is not None:
|
if es_connection is not None:
|
||||||
self.client = es_connection.options(
|
headers = dict(es_connection._headers)
|
||||||
headers={"user-agent": self.get_user_agent()}
|
headers.update({"user-agent": self.get_user_agent()})
|
||||||
)
|
self.client = es_connection.options(headers=headers)
|
||||||
elif es_url is not None or es_cloud_id is not None:
|
elif es_url is not None or es_cloud_id is not None:
|
||||||
self.client = ElasticsearchStore.connect_to_elasticsearch(
|
self.client = ElasticsearchStore.connect_to_elasticsearch(
|
||||||
es_url=es_url,
|
es_url=es_url,
|
||||||
|
Loading…
Reference in New Issue
Block a user