Skip to content

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

Fix: handle id as keyword (#14729)

Lynnefe6d23d61ce
diff --git a/conf/mapping.json b/conf/mapping.json
index f32acb02bc..495f7c7763 100644
--- a/conf/mapping.json
+++ b/conf/mapping.json
@@ -92,7 +92,7 @@
{
"kwd": {
"match_pattern": "regex",
- "match": "^(.*_(kwd|id|ids|uid|uids)|uid)$",
+ "match": "^(.*_(kwd|id|ids|uid|uids)|uid|id)$",
"mapping": {
"type": "keyword",
"similarity": "boolean",
diff --git a/memory/utils/es_conn.py b/memory/utils/es_conn.py
index 15a360e340..60eda59f62 100644
--- a/memory/utils/es_conn.py
+++ b/memory/utils/es_conn.py
@@ -209,7 +209,7 @@ class ESConnection(ESConnectionBase):
elif field == "id":
continue # id as "text", not a "keyword", order by it will cause error
else:
- order_info = {"order": order, "unmapped_type": "text"}
+ order_info = {"order": order, "unmapped_type": "keyword"}
orders.append({field: order_info})
s = s.sort(*orders)
diff --git a/rag/utils/es_conn.py b/rag/utils/es_conn.py
index cb4c3d8438..51356befad 100644
--- a/rag/utils/es_conn.py
+++ b/rag/utils/es_conn.py
@@ -247,7 +247,7 @@ class ESConnection(ESConnectionBase):
elif field == "id":
continue # id as "text", not a "keyword", order by it will cause error
else:
- order_info = {"order": order, "unmapped_type": "text"}
+ order_info = {"order": order, "unmapped_type": "keyword"}
orders.append({field: order_info})
s = s.sort(*orders)
if agg_fields: