8000 [Bug]: Dataset-level structure graph merge silently "succeeds" with zero output when entity rows exceed ES max_result_window · Issue #19649 · infiniflow/ragflow · GitHub
[go: up one dir, main page]

Skip to content
8000

[Bug]: Dataset-level structure graph merge silently "succeeds" with zero output when entity rows exceed ES max_result_window #19649

Open

Description

@rosaetempus

Self Checks

  • 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:

  1. 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.
  2. 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

  1. Build doc-level KG (knowledge compilation) for a dataset until entity rows > 10,000.
  2. POST /api/v1/datasets/{id}/index?type=graph.
  3. 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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0