Skip to content

fix(mappings): support any embedding dimension on Elasticsearch - #20368

Merged
yuzhichang merged 1 commit into
infiniflow:mainfrom
qinling0210:es_mapping
Sep 29, 2026
Merged

yuzhichang merged 1 commit into
infiniflow:mainfrom
qinling0210:es_mapping

Conversation

@qinling0210

Copy link
Copy Markdown
Contributor

Summary

Support any embedding dimension on Elasticsearch

@qinling0210 qinling0210 self-assigned this Sep 29, 2026
@qinling0210 qinling0210 added the ci Continue Integration label Sep 29, 2026
@coderabbitai

coderabbitai Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 31c18321-2ffc-4ffc-a23e-425f99b50d35

📥 Commits

Reviewing files that changed from the base of the PR and between 67d6872 and dbd629c.

📒 Files selected for processing (2)
  • conf/mapping.json
  • internal/service/nlp/datasetnav_test.go

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The dense-vector mapping now matches fields named q_*_vec without a fixed dimension. The test comment now describes this mapping. The synthetic test vector remains 1024-dimensional.

Changes

Dense-Vector Mapping

Layer / File(s) Summary
Dynamic dense-vector template
conf/mapping.json, internal/service/nlp/datasetnav_test.go
The mapping uses a q_*_vec template with indexed cosine similarity and no fixed dimension. The test comment describes the updated template; its synthetic vector remains 1024-dimensional.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~7 minutes

Change: Bug fix

Suggested reviewers: yuzhichang

Merge Risk: ⚪ Minimal · up to dbd62

The default deployment supports the new mapping, and no actionable merge-blocking issue is established. Deployments that override the Elasticsearch version should use 8.11 or newer.

Security Architecture Review

Security architecture risk: 🟡 Moderate · up to dbd62

New indices can accept additional embedding dimensions, but existing indices retain their earlier mappings. Searches using a newly supported dimension may therefore fail on existing data until those indices are migrated. No new public endpoint or verified security flaw is shown.

Retained concerns

  • Medium · architecture · inferred: Updating the index template does not migrate existing indices. When an existing index retains the old dimension-specific templates, a newly supported vector dimension can be indexed without the intended dense-vector mapping, leaving dimension-based KNN search unavailable for that index until its mapping is repaired or the index is rebuilt.
Security review details

Security Blast Radius

  • inferred — The changed template can affect newly created ragflow_* chunk indices, and an incorrectly mapped vector field would affect writes or vector search within its index. Tenant partitioning and the maximum independently controllable index scope were not established.

Trust Boundaries and Controls

  • observed — The examined bulk writer checks for document identifiers and reports Elasticsearch item failures, but passes document fields through to indexing. Its upstream authorization and vector-field construction are outside the hydrated write-path evidence.

Resilience and Maintainability Implications

  • inferred — Reporting a failed bulk item contains silent data loss, but does not undo preceding successful batches or repair an incompatible persistent field mapping.

Hardening Proposals

  • proposed — Before relying on arbitrary dimensions, verify field-name and vector-length agreement at ingestion, and define an existing-index migration and recovery path for failed or partial indexing.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: Elasticsearch mappings now support any embedding dimension.
Description check ✅ Passed The description states the PR objective and matches the changes. It does not include background context, but the required summary is present and the omission is non-critical.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

I twitch my nose at vectors new
One template maps their fields in view
No fixed dimension holds them tight
Cosine keeps the match in sight
I hop along; the tests stay true

Comment @coderabbitai help to get the list of available commands.

@yuzhichang
yuzhichang merged commit 02569ae into infiniflow:main Sep 29, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants