Skip to content

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

Not allow to sort by id (#14526)

Wang Qif45ce00347f5
diff --git a/memory/utils/es_conn.py b/memory/utils/es_conn.py
index afa06a169a..15a360e340 100644
--- a/memory/utils/es_conn.py
+++ b/memory/utils/es_conn.py
@@ -206,6 +206,8 @@ class ESConnection(ESConnectionBase):
order = "asc" if order == 0 else "desc"
if field.endswith("_int") or field.endswith("_flt"):
order_info = {"order": order, "unmapped_type": "float"}
+ elif field == "id":
+ continue # id as "text", not a "keyword", order by it will cause error
else:
order_info = {"order": order, "unmapped_type": "text"}
orders.append({field: order_info})
diff --git a/rag/utils/es_conn.py b/rag/utils/es_conn.py
index 3e0ab369f5..cb4c3d8438 100644
--- a/rag/utils/es_conn.py
+++ b/rag/utils/es_conn.py
@@ -244,6 +244,8 @@ class ESConnection(ESConnectionBase):
"mode": "avg", "numeric_type": "double"}
elif field.endswith("_int") or field.endswith("_flt"):
order_info = {"order": order, "unmapped_type": "float"}
+ elif field == "id":
+ continue # id as "text", not a "keyword", order by it will cause error
else:
order_info = {"order": order, "unmapped_type": "text"}
orders.append({field: order_info})