mirror of
https://github.com/hwchase17/langchain.git
synced 2025-05-31 20:19:43 +00:00
fix bes vector store search (#12828)
**Issue:** fix search body in baidu cloud vectorsearch --------- Co-authored-by: wemysschen <root@icoding-cwx.bcc-szzj.baidu.com>
This commit is contained in:
parent
f04e4df7f9
commit
e14aa37d59
@ -95,7 +95,8 @@ class BESVectorStore(VectorStore):
|
||||
connection_params: Dict[str, Any] = {}
|
||||
|
||||
connection_params["hosts"] = [bes_url]
|
||||
connection_params["basic_auth"] = (username, password)
|
||||
if username and password:
|
||||
connection_params["basic_auth"] = (username, password)
|
||||
|
||||
es_client = elasticsearch.Elasticsearch(**connection_params)
|
||||
try:
|
||||
@ -236,7 +237,6 @@ class BESVectorStore(VectorStore):
|
||||
|
||||
if "linear" == self.index_type:
|
||||
query_vector_body["linear"] = True
|
||||
query_vector_body["space_type"] = self.space_type
|
||||
else:
|
||||
query_vector_body["ef"] = search_params.get("ef", 10)
|
||||
|
||||
@ -279,7 +279,7 @@ class BESVectorStore(VectorStore):
|
||||
logger.debug(f"Query body: {query_body}")
|
||||
|
||||
# Perform the kNN search on the BES index and return the results.
|
||||
response = self.client.search(index=self.index_name, **query_body)
|
||||
response = self.client.search(index=self.index_name, body=query_body)
|
||||
logger.debug(f"response={response}")
|
||||
|
||||
hits = [hit for hit in response["hits"]["hits"]]
|
||||
|
Loading…
Reference in New Issue
Block a user