Skip to content

Conversation

@thecoop
Copy link
Member

@thecoop thecoop commented Oct 3, 2025

Enables direct IO rescoring and bfloat16 elements for the bbq_hnsw and bbq_disk vector types, and bfloat16 elements for hnsw and bbq_flat element types, using a new generic flat vector format that is element-type-agnostic.

This adds new options on_disk_rescoring: true and element_type: bfloat16 to index options, allowing direct IO to be used for rescoring, and bfloat16 to be used as a raw vector type.

element_type: bfloat16 reduces disk usage for raw vectors (by far the dominating cost of storing vectors on disk) by 50%, at the cost of a ~5% runtime performance reduction

on_disk_rescore: true does not load raw vectors into disk when rescoring vectors, significantly improving HNSW performance when the vectors do not all fit in memory. Due to architectural limitations, this option can only be set on newly-indexed vectors, requiring a reindex to enable on-disk rescoring for existing vectors.

Int and flat vector types will be updated in a separate PR.

Specifing bfloat16 and using the new formats is currently behind a feature flag, pending further PRs in this area

@thecoop thecoop force-pushed the hnsw-directio-bfloat16-enabled branch from 8119a8c to 803dfc1 Compare October 10, 2025 10:13
@thecoop thecoop force-pushed the hnsw-directio-bfloat16-enabled branch from 4f81b03 to 05f0b71 Compare October 10, 2025 10:45
@thecoop thecoop changed the title Enable directIO on bbq_hnsw Enable directIO and bfloat16 on bbq_hnsw Oct 10, 2025
@thecoop
Copy link
Member Author

thecoop commented Nov 5, 2025

I've added a feature flag to enable the new formats - so we can turn them on all at once when ready

@thecoop thecoop requested a review from benwtrent November 5, 2025 16:57
phananh1010 added a commit to phananh1010/elasticsearch that referenced this pull request Nov 6, 2025
BASE=bcb861ae10000f94977487193d242c6f30443741
HEAD=eed749e3a6d09e03e0731f5c526fa49e15cd471a
Branch=main
phananh1010 added a commit to phananh1010/elasticsearch that referenced this pull request Nov 7, 2025
BASE=bcb861ae10000f94977487193d242c6f30443741
HEAD=ab5ee251aa0c298a2ee2d980c54eb93af40a064a
Branch=main
Copy link
Member

@benwtrent benwtrent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is good. I have reviewed it many times.

My concerns are:

  • I think we should run yaml tests all the time, so let's enable the feature flag for the yaml test runners?
  • Let's not parse on_disk_rescore for BBQHnsw (I think thats the only one that was added?) unless the flag is enabled. My concern is that we accept the parameter and then do nothing (which we shouldn't do)

Comment on lines -1734 to +1738
Object onDiskRescoreNode = indexOptionsMap.remove("on_disk_rescore");
Object onDiskRescoreNode = ES93GenericFlatVectorsFormat.GENERIC_VECTOR_FORMAT.isEnabled()
? indexOptionsMap.remove("on_disk_rescore")
: false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure we can do this? Do we know if we have shipped a version of ES that allowed this option for diskbbq?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

9.2 didn't include it, so we can change it here

Copy link
Contributor

@john-wagster john-wagster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a lot of changes but I tried to go through it bit at a time today and I think it looks good. Nothing stood out to me as bad or missing. lgtm

@thecoop thecoop merged commit 557aeaa into elastic:main Nov 10, 2025
34 checks passed
@thecoop thecoop deleted the hnsw-directio-bfloat16-enabled branch November 10, 2025 10:33
Kubik42 pushed a commit to Kubik42/elasticsearch that referenced this pull request Nov 10, 2025
…ypes (elastic#135940)

Currently behind a feature flag, pending further development
thecoop added a commit that referenced this pull request Nov 10, 2025
thecoop added a commit to thecoop/elasticsearch that referenced this pull request Nov 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>non-issue :Search Relevance/Vectors Vector search Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants