You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
8000
Dismiss alert
{{ message }}
Repository navigation
8000
[Bug]: Dataset-level structure graph merge silently "succeeds" with zero output when entity rows exceed ES max_result_window #19649
I have searched for existing issues, including closed ones.
I confirm that I am using English to submit this report.
Non-english title submitions will be closed directly.
Please do not modify this template :)
RAGFlow workspace code commit ID
Official image infiniflow/ragflow:v0.27.2 (docker)
RAGFlow image version
v0.27.2
Other environment information
Official docker compose stack; Elasticsearch 8.11.3; one dataset with 381 documents and ~300k doc-level KG entity rows.
Expected behavior
POST /api/v1/datasets/{id}/index?type=graph (dataset-level structure graph merge) should read all doc-scope entity/relation rows and write dataset-scope rows, and fail the task when the doc store errors.
Actual behavior
With more than 10k entity rows the merge finishes in seconds with progress=1 ("Built 1/1 dataset graph(s)") but writes zero dataset rows. The store error is logged but swallowed:
ERROR ESConnection.search [... 'from': 10000, 'size': 1000 ...]
BadRequestError(400, 'search_phase_execution_exception', 'Result window is too large, from + size must be less than or equal to: [10000] but was [11000]')
ERROR structure_merge: search failed for kb=...
Two stacked causes:
dataset_structure_merger paginates with an empty OrderByExpr, so ESConnection.search never takes its search_after path (it requires an explicit sort) and from+size exceeds index.max_result_window; _index_search then swallows the exception and returns [], so the task is marked done with zero output.
Even with an explicit order, ESConnection.search silently drops sorting on the id field (legacy "id as text" guard) — but id is keyword in RAGFlow index templates. An unsorted query on the search_after path returns no sort values, so it yields empty pages past the window (silent truncation).
Workaround (verified in production): raise index.max_result_window (e.g. 500000) and re-run the task — it then takes ~18 min and writes ~380k dataset-scope rows correctly.
Steps to reproduce
Build doc-level KG (knowledge compilation) for a dataset until entity rows > 10,000.
POST /api/v1/datasets/{id}/index?type=graph.
Task reports done within seconds; scope_kwd=dataset rows = 0; ES logs the BadRequestError above.
Fix submitted in PR (orders paged scans by id, propagates store errors, sorts id as keyword).
Activity
fix(es): fail loudly on a stalled search_after skip and sort the rema…
fix(es): resolve the sortable form of the id field per index mapping
fix(es): allow sort on the id field (infiniflow#19649)
fix(es): fail loudly on a stalled search_after skip and sort the rema…
fix(es): resolve the sortable form of the id field per index mapping
fix(es): allow sort on the id field (infiniflow#19649)
fix(es): fail loudly on a stalled search_after skip and sort the rema…
fix(es): resolve the sortable form of the id field per index mapping