Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Fix: OpenSearch retrieval no return & Add documentation of /retrieval (#11083)

Billy Bao5629fbd2ca60
diff --git a/docs/references/http_api_reference.md b/docs/references/http_api_reference.md
index 7af9d4bdfa..f2b86a7353 100644
--- a/docs/references/http_api_reference.md
+++ b/docs/references/http_api_reference.md
@@ -1840,7 +1840,7 @@ Retrieves chunks from specified datasets.
- `"highlight"`: `boolean`
- `"cross_languages"`: `list[string]`
- `"metadata_condition"`: `object`
-
+ - `"use_kg"`: `boolean`
##### Request example
```bash
@@ -1888,6 +1888,8 @@ curl --request POST \
The weight of vector cosine similarity. Defaults to `0.3`. If x represents the weight of vector cosine similarity, then (1 - x) is the term similarity weight.
- `"top_k"`: (*Body parameter*), `integer`
The number of chunks engaged in vector cosine computation. Defaults to `1024`.
+- `"use_kg"`: (*Body parameter*), `boolean`
+ The search includes text chunks related to the knowledge graph of the selected dataset to handle complex multi-hop queries. Defaults to `False`.
- `"rerank_id"`: (*Body parameter*), `integer`
The ID of the rerank model.
- `"keyword"`: (*Body parameter*), `boolean`
diff --git a/rag/nlp/search.py b/rag/nlp/search.py
index 09c1324d32..1bf0abe041 100644
--- a/rag/nlp/search.py
+++ b/rag/nlp/search.py
@@ -384,7 +384,7 @@ class Dealer:
rank_feature=rank_feature)
else:
lower_case_doc_engine = os.getenv('DOC_ENGINE', 'elasticsearch')
- if lower_case_doc_engine == "elasticsearch":
+ if lower_case_doc_engine in ["elasticsearch","opensearch"]:
# ElasticSearch doesn't normalize each way score before fusion.
sim, tsim, vsim = self.rerank(
sres, question, 1 - vector_similarity_weight, vector_similarity_weight,