Add enable_hnsw option for payload field schema#7887
Merged
generall merged 3 commits intoqdrant:devfrom Jan 9, 2026
Merged
Conversation
added 2 commits
January 9, 2026 01:28
Add optional enable_hnsw parameter to all payload index types to control whether additional HNSW graph links are built for each indexed field. - Add enable_hnsw field to all 8 payload index param types - Update gRPC proto definitions and conversions - Update OpenAPI schema - Modify HNSW graph builder to respect enable_hnsw flag - Add enable_hnsw() helper methods to PayloadSchemaParams and PayloadFieldSchema - Update all tests to include new field (default: None) When enable_hnsw is true and payload_M > 0, additional HNSW links will be built for the payload field. Default value is true for backward compatibility.
Member
|
Thanks for the PR! This feature was in our backlog with high priority, so we try to review and merge ASAP |
timvisee
reviewed
Jan 9, 2026
Member
timvisee
left a comment
There was a problem hiding this comment.
Thank you very much! This is exactly how I imagined it.
How about we rename this property to enrich_hnsw, or is enable_hnsw better? Wdyt?
Member
|
I would keep |
timvisee
approved these changes
Jan 9, 2026
generall
approved these changes
Jan 9, 2026
6 tasks
generall
pushed a commit
that referenced
this pull request
Feb 9, 2026
* feat: Add enable_hnsw option for payload field indexes Add optional enable_hnsw parameter to all payload index types to control whether additional HNSW graph links are built for each indexed field. - Add enable_hnsw field to all 8 payload index param types - Update gRPC proto definitions and conversions - Update OpenAPI schema - Modify HNSW graph builder to respect enable_hnsw flag - Add enable_hnsw() helper methods to PayloadSchemaParams and PayloadFieldSchema - Update all tests to include new field (default: None) When enable_hnsw is true and payload_M > 0, additional HNSW links will be built for the payload field. Default value is true for backward compatibility. * Fix Some format problems * fix: address comment problem --------- Co-authored-by: EC2 Default User <ec2-user@ip-10-78-171-148.ec2.internal>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All Submissions:
devbranch. Did you create your branch fromdev?New Feature Submissions:
cargo +nightly fmt --allcommand prior to submission?cargo clippy --workspace --all-featurescommand?Changes to Core Features:
Description
This PR adds an optional
enable_hnswparameter to all payload field index types, providing fine-grained control over HNSW graph construction for individual indexed fields.Changes
Core Data Types
enable_hnsw: Option<bool>field to all 8 payload index parameter types:KeywordIndexParamsIntegerIndexParamsFloatIndexParamsGeoIndexParamsTextIndexParamsBoolIndexParamsDatetimeIndexParamsUuidIndexParamsAPI Layer
collections.protowith documentationFrom/TryFromimplementations inconversions.rsto handle new fieldopenapi.jsonqdrant.rswith new field definitionsCore Logic
hnsw.rsto filter fields based onenable_hnswflagenable_hnsw()toPayloadSchemaParamsandPayloadFieldSchematypesenable_hnsw=falseare skipped during additional HNSW links constructionTests
enable_hnsw: Nonefor backward compatibilitypayload_index_test.rssegment_on_disk_snapshot.rsmutable_text_index.rsfull_text_index/tests/mod.rstokenizers/mod.rstest_payload_indexing.pyMotivation
When
payload_m > 0is configured in HNSW settings, Qdrant builds additional graph links for all indexed payload fields to improve filtered search performance.However, when a collection contains both dense and sparse vectors, payload indexes intended only for sparse vector filtering will still affect the dense vector's HNSW graph. This creates additional graph links in the dense vector's HNSW index that will never be used in queries. This causes the following problems:
This feature allows users to:
Behavior
true(maintains full backward compatibility)enable_hnsw=false: The field will still be indexed normally for filtering, but won't have additional HNSW links builtpayload_m > 0enable_hnsw=false. Skip building additional index for field {field_name}Example Usage
REST API
gRPC
KeywordIndexParams { is_tenant: false, on_disk: false, enable_hnsw: false // Disable HNSW for this field }Backward Compatibility
✅ Fully backward compatible
true, preserving existing behavior