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>
pull/12876/head
wemysschen 9 months ago committed by GitHub
parent f04e4df7f9
commit e14aa37d59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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…
Cancel
Save